Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <QApplication>
  2. #include <QHBoxLayout>
  3. #include <QSlider>
  4. #include <QSpinBox>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. QApplication app(argc, argv);
  9.  
  10. QWidget *window = new QWidget;
  11. window->setWindowTitle("Enter Your Age");
  12.  
  13. QSpinBox *spinBox = new QSpinBox;
  14. QSlider *slider = new QSlider(Qt::Horizontal);
  15. spinBox->setRange(0, 130);
  16. slider->setRange(0, 130);
  17.  
  18. QObject::connect(spinBox, SIGNAL(valueChanged(int)),
  19. slider, SLOT(setValue(int)));
  20. QObject::connect(slider, SIGNAL(valueChanged(int)),
  21. spinBox, SLOT(setValue(int)));
  22. spinBox->setValue(35);
  23.  
  24. QHBoxLayout *layout = new QHBoxLayout;
  25. layout->addWidget(spinBox);
  26. layout->addWidget(slider);
  27. window->setLayout(layout);
  28.  
  29. window->show();
  30.  
  31. return app.exec();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement