Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "secondScreen.hpp"
- SecondScreen::SecondScreen(QStackedWidget* swgt, SecondScreen* pointer) :QWidget(pointer) {
- /**
- * Install the fixed size for scroll widget of second screen
- */
- this->setFixedSize(QApplication::desktop()->availableGeometry(swgt).width(), QApplication::desktop()->availableGeometry(swgt).height());
- /**
- * Create the trace of scroll bar
- */
- QWidget* pTraceOfScrollBar = new QWidget;
- pTraceOfScrollBar->setFixedSize(QApplication::desktop()->availableGeometry(this).width()/10*2/10, QApplication::desktop()->availableGeometry(this).height());
- QPalette plt;
- plt.setColor(pTraceOfScrollBar->backgroundRole(), QColor(211, 225, 213, 102));
- pTraceOfScrollBar->setPalette(plt);
- pTraceOfScrollBar->setAutoFillBackground(true);
- /**
- * Create the scroll bar
- */
- pScrollBar = new QPushButton(pTraceOfScrollBar);
- pScrollBar->setFixedSize(QApplication::desktop()->availableGeometry(pTraceOfScrollBar).width()/10*53/10, QApplication::desktop()->availableGeometry(pTraceOfScrollBar).height()/10*5/10);
- pScrollBar->setStyleSheet("background-color: blue; border-radius: 16px;");
- pScrollBar->setAutoFillBackground(true);
- /**
- * Install the fixed size for scroll widget of second screen
- */
- QWidget* wgt = new QWidget;
- /**
- * Create the needing objects for second screen
- */
- WidgetOfSecondScreen* widgetOfSecondScreen = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen2 = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen3 = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen4 = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen5 = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen6 = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen7 = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen8 = new WidgetOfSecondScreen(this);
- WidgetOfSecondScreen* widgetOfSecondScreen9 = new WidgetOfSecondScreen(this);
- /**
- * Create the layout of second screen
- */
- QVBoxLayout* pvbox = new QVBoxLayout;
- pvbox->setContentsMargins(0, 0, 0, 0);
- pvbox->setSpacing(0);
- pvbox->addWidget(widgetOfSecondScreen);
- pvbox->addWidget(widgetOfSecondScreen2);
- pvbox->addWidget(widgetOfSecondScreen3);
- pvbox->addWidget(widgetOfSecondScreen4);
- pvbox->addWidget(widgetOfSecondScreen5);
- pvbox->addWidget(widgetOfSecondScreen6);
- pvbox->addWidget(widgetOfSecondScreen7);
- pvbox->addWidget(widgetOfSecondScreen8);
- pvbox->addWidget(widgetOfSecondScreen9);
- pvbox->setAlignment(AlignTop);
- /**
- * Install the created layout to main widget of second screen
- */
- wgt->setLayout(pvbox);
- /**
- * Create the gridLayout
- */
- QGridLayout* pGridLayout= new QGridLayout;
- pGridLayout->setContentsMargins(0, 0, 0, 0);
- pGridLayout->setSpacing(0);
- pGridLayout->addWidget(wgt, 0, 0, 0, -1);
- pGridLayout->addWidget(pTraceOfScrollBar, 0, 1, 0, -1);
- this->setLayout(pGridLayout);
- }
- /**
- * Create the deconstructor
- */
- SecondScreen::~SecondScreen() {
- delete this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement