Advertisement
PlotnikovPhilipp

Untitled

Mar 28th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. #include "secondScreen.hpp"
  2.  
  3. SecondScreen::SecondScreen(QStackedWidget* swgt, SecondScreen* pointer) :QWidget(pointer) {
  4.  
  5. /**
  6. * Install the fixed size for scroll widget of second screen
  7. */
  8.  
  9. this->setFixedSize(QApplication::desktop()->availableGeometry(swgt).width(), QApplication::desktop()->availableGeometry(swgt).height());
  10.  
  11. /**
  12. * Create the trace of scroll bar
  13. */
  14.  
  15. QWidget* pTraceOfScrollBar = new QWidget;
  16. pTraceOfScrollBar->setFixedSize(QApplication::desktop()->availableGeometry(this).width()/10*2/10, QApplication::desktop()->availableGeometry(this).height());
  17. QPalette plt;
  18. plt.setColor(pTraceOfScrollBar->backgroundRole(), QColor(211, 225, 213, 102));
  19. pTraceOfScrollBar->setPalette(plt);
  20. pTraceOfScrollBar->setAutoFillBackground(true);
  21.  
  22. /**
  23. * Create the scroll bar
  24. */
  25.  
  26. pScrollBar = new QPushButton(pTraceOfScrollBar);
  27. pScrollBar->setFixedSize(QApplication::desktop()->availableGeometry(pTraceOfScrollBar).width()/10*53/10, QApplication::desktop()->availableGeometry(pTraceOfScrollBar).height()/10*5/10);
  28. pScrollBar->setStyleSheet("background-color: blue; border-radius: 16px;");
  29. pScrollBar->setAutoFillBackground(true);
  30.  
  31. /**
  32. * Install the fixed size for scroll widget of second screen
  33. */
  34.  
  35. QWidget* wgt = new QWidget;
  36.  
  37. /**
  38. * Create the needing objects for second screen
  39. */
  40.  
  41. WidgetOfSecondScreen* widgetOfSecondScreen = new WidgetOfSecondScreen(this);
  42. WidgetOfSecondScreen* widgetOfSecondScreen2 = new WidgetOfSecondScreen(this);
  43. WidgetOfSecondScreen* widgetOfSecondScreen3 = new WidgetOfSecondScreen(this);
  44. WidgetOfSecondScreen* widgetOfSecondScreen4 = new WidgetOfSecondScreen(this);
  45. WidgetOfSecondScreen* widgetOfSecondScreen5 = new WidgetOfSecondScreen(this);
  46. WidgetOfSecondScreen* widgetOfSecondScreen6 = new WidgetOfSecondScreen(this);
  47. WidgetOfSecondScreen* widgetOfSecondScreen7 = new WidgetOfSecondScreen(this);
  48. WidgetOfSecondScreen* widgetOfSecondScreen8 = new WidgetOfSecondScreen(this);
  49. WidgetOfSecondScreen* widgetOfSecondScreen9 = new WidgetOfSecondScreen(this);
  50.  
  51. /**
  52. * Create the layout of second screen
  53. */
  54.  
  55. QVBoxLayout* pvbox = new QVBoxLayout;
  56. pvbox->setContentsMargins(0, 0, 0, 0);
  57. pvbox->setSpacing(0);
  58. pvbox->addWidget(widgetOfSecondScreen);
  59. pvbox->addWidget(widgetOfSecondScreen2);
  60. pvbox->addWidget(widgetOfSecondScreen3);
  61. pvbox->addWidget(widgetOfSecondScreen4);
  62. pvbox->addWidget(widgetOfSecondScreen5);
  63. pvbox->addWidget(widgetOfSecondScreen6);
  64. pvbox->addWidget(widgetOfSecondScreen7);
  65. pvbox->addWidget(widgetOfSecondScreen8);
  66. pvbox->addWidget(widgetOfSecondScreen9);
  67. pvbox->setAlignment(AlignTop);
  68.  
  69. /**
  70. * Install the created layout to main widget of second screen
  71. */
  72.  
  73. wgt->setLayout(pvbox);
  74.  
  75. /**
  76. * Create the gridLayout
  77. */
  78.  
  79. QGridLayout* pGridLayout= new QGridLayout;
  80. pGridLayout->setContentsMargins(0, 0, 0, 0);
  81. pGridLayout->setSpacing(0);
  82. pGridLayout->addWidget(wgt, 0, 0, 0, -1);
  83. pGridLayout->addWidget(pTraceOfScrollBar, 0, 1, 0, -1);
  84.  
  85. this->setLayout(pGridLayout);
  86.  
  87. }
  88.  
  89. /**
  90. * Create the deconstructor
  91. */
  92.  
  93. SecondScreen::~SecondScreen() {
  94. delete this;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement