Advertisement
Jgug

S4.L3.Main

Mar 19th, 2013
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.99 KB | None | 0 0
  1. #include "solution.h"
  2. #include <QApplication>
  3. #include <QWidget>
  4. #include <QLabel>
  5. #include <QPushButton>
  6. #include <QRadioButton>
  7. #include <QCheckBox>
  8. #include <QGridLayout>
  9. #include <QVBoxLayout>
  10. #include <QHBoxLayout>
  11. #include <QLineEdit>
  12. #include <QTextEdit>
  13.  
  14. int main(int argc, char *argv[])
  15. {
  16.     QApplication app(argc, argv);
  17.     Widget wgt_1;
  18.  
  19.     QLabel* lbl_XVal = new QLabel("X value");
  20.     QLabel* lbl_YVal = new QLabel("Y value");
  21.     QLabel* lbl_f1 = new QLabel("cos(x)");
  22.     QLabel* lbl_f2 = new QLabel("sin(x)");
  23.     QLabel* lbl_f3 = new QLabel("hyinus(x)");
  24.     QLabel* lbl_min = new QLabel("min");
  25.     QLabel* lbl_max = new QLabel("max");
  26.     QLabel* lbl_res = new QLabel("Results");
  27.  
  28.     QLineEdit* lEd_XVal = new QLineEdit;
  29.     QLineEdit* lEd_YVal = new QLineEdit;
  30.  
  31.     QTextEdit* tEd_res = new QTextEdit;
  32.  
  33.     QRadioButton* rBt_f1 = new QRadioButton;
  34.     QRadioButton* rBt_f2 = new QRadioButton;
  35.     QRadioButton* rBt_f3 = new QRadioButton;
  36.  
  37.     QCheckBox* chB_min = new QCheckBox;
  38.     QCheckBox* chB_max = new QCheckBox;
  39.  
  40.     QPushButton* pBt_eval = new QPushButton("Evaluate");
  41.     QPushButton* pBt_close = new QPushButton("Close");
  42.  
  43.     QGridLayout* grLay_input = new QGridLayout;
  44.     grLay_input->setMargin(5);
  45.     grLay_input->setSpacing(10);
  46.     grLay_input->addWidget(lbl_XVal, 0, 0);
  47.     grLay_input->addWidget(lbl_YVal, 2, 0);
  48.     grLay_input->addWidget(lEd_XVal, 0, 1);
  49.     grLay_input->addWidget(lEd_YVal, 2, 1);
  50.  
  51.     QGridLayout* grLay_func = new QGridLayout;
  52.     grLay_func->setMargin(5);
  53.     grLay_func->setSpacing(10);
  54.     grLay_func->addWidget(lbl_f1, 0, 0);
  55.     grLay_func->addWidget(lbl_f2, 1, 0);
  56.     grLay_func->addWidget(lbl_f3, 2, 0);
  57.     grLay_func->addWidget(rBt_f1, 0, 1);
  58.     grLay_func->addWidget(rBt_f2, 1, 1);
  59.     grLay_func->addWidget(rBt_f3, 2, 1);
  60.  
  61.     QHBoxLayout* hbLay_layOne = new QHBoxLayout;
  62.     hbLay_layOne->setMargin(5);
  63.     hbLay_layOne->setSpacing(10);
  64.     hbLay_layOne->addLayout(grLay_input);
  65.     hbLay_layOne->addLayout(grLay_func);
  66.  
  67.     QHBoxLayout* hbLay_ext = new QHBoxLayout;
  68.     hbLay_ext->setMargin(5);
  69.     hbLay_ext->setSpacing(10);
  70.     hbLay_ext->addWidget(lbl_min);
  71.     hbLay_ext->addWidget(chB_min);
  72.     hbLay_ext->addWidget(lbl_max);
  73.     hbLay_ext->addWidget(chB_max);
  74.  
  75.     QHBoxLayout* hbLay_res = new QHBoxLayout;
  76.     hbLay_res->setMargin(5);
  77.     hbLay_res->setSpacing(10);
  78.     hbLay_res->addWidget(lbl_res);
  79.     hbLay_res->addWidget(tEd_res);
  80.  
  81.     QHBoxLayout* hbLay_btn = new QHBoxLayout;
  82.     hbLay_btn->setMargin(5);
  83.     hbLay_btn->setSpacing(10);
  84.     hbLay_btn->addWidget(pBt_eval);
  85.     hbLay_btn->addWidget(pBt_close);
  86.  
  87.     QVBoxLayout* vbLay_layOne = new QVBoxLayout;
  88.     vbLay_layOne->setMargin(5);
  89.     vbLay_layOne->setSpacing(10);
  90.     vbLay_layOne->addLayout(hbLay_layOne);
  91.     vbLay_layOne->addLayout(hbLay_ext);
  92.     vbLay_layOne->addLayout(hbLay_res);
  93.     vbLay_layOne->addLayout(hbLay_btn);
  94.  
  95.     wgt_1.setLayout(vbLay_layOne);
  96.     wgt_1.show();
  97.    
  98.     return app.exec();
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement