Advertisement
TShiva

qt_second_project

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