Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1.  
  2. MainWindow::MainWindow(QWidget *parent) :
  3. QMainWindow(parent)
  4. {
  5.  
  6. QWidget* centralWidget = new QWidget;
  7. QHBoxLayout* centralLayout = new QHBoxLayout(centralWidget);
  8.  
  9. // fill the view
  10. QWidget* content = new QWidget;
  11. QGridLayout* contentLayout = new QGridLayout(content);
  12. for(int i = 0; i < 10; i+=2)
  13. {
  14. QLabel* title = new QLabel("myTitle");
  15. QLineEdit* valueField = new QLineEdit();
  16.  
  17. contentLayout->addWidget(title, i, i%2);
  18. contentLayout->addWidget(valueField, i+1, i%2);
  19. }
  20.  
  21. // scrollarea
  22. QScrollArea* area = new QScrollArea;
  23. area->setWidget(content);
  24. area->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  25.  
  26.  
  27. centralLayout->addWidget(area);
  28. this->setCentralWidget(centralWidget);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement