1 #include <QApplication> 2 #include <QHBoxLayout> 3 #include <QVBoxLayout> 4 #include <QGridLayout> 5 #include <QPushButton> 6 #include <QLabel> 7 #include <QComboBox> 8 #include <QTimeEdit> 9 #include <QGroupBox> 10 #include <QSettings> 11 #include <QTimer> 12 #include <QMessageBox> 13 #include <QTextEdit> 14 #include <QLineEdit> 15 16 #include <errno.h> 17 18 19 int main(int argc,char **argv) 20 { 21 QApplication app (argc, argv); 22 23 QWidget *window = new QWidget; 24 window->setGeometry(0, 0, 500, 400); 25 26 QHBoxLayout *layout_usrname = new QHBoxLayout; 27 QHBoxLayout *layout_name = new QHBoxLayout; 28 QHBoxLayout *layout_sex = new QHBoxLayout; 29 QHBoxLayout *layout_apartment = new QHBoxLayout; 30 QHBoxLayout *layout_age = new QHBoxLayout; 31 QHBoxLayout *layout_ps = new QHBoxLayout; 32 QHBoxLayout *layout_head = new QHBoxLayout; 33 QHBoxLayout *layout_btn = new QHBoxLayout; 34 QVBoxLayout *layout_left = new QVBoxLayout; 35 QVBoxLayout *layout_right = new QVBoxLayout; 36 QHBoxLayout *layout_total = new QHBoxLayout; 37 38 QLabel *label_usrname = new QLabel ("user"); 39 QLineEdit *text_usrname = new QLineEdit; 40 41 QLabel *label_name = new QLabel ("name"); 42 QLineEdit *text_name = new QLineEdit; 43 44 QLabel *label_sex = new QLabel ("sex"); 45 QComboBox *formatCombo = new QComboBox; 46 formatCombo->addItem ("male", QVariant ((int) 0)); 47 formatCombo->addItem ("female", QVariant ((int) 0)); 48 49 QLabel *label_apartment = new QLabel ("apartment"); 50 QTextEdit *text_apartment = new QTextEdit; 51 52 QLabel *label_age = new QLabel ("age"); 53 QLineEdit *text_age = new QLineEdit; 54 55 QLabel *label_ps = new QLabel ("ps"); 56 QLineEdit *text_ps = new QLineEdit; 57 58 QLabel *label_head = new QLabel ("head"); 59 QPushButton *change = new QPushButton ("change"); 60 61 QLabel *label_instruction = new QLabel ("instruction"); 62 63 QTextEdit *text_instruction = new QTextEdit; 64 65 QPushButton *OK = new QPushButton ("OK"); 66 QPushButton *cancel = new QPushButton ("cancel"); 67 68 layout_total->addLayout(layout_left); 69 70 layout_left->addLayout(layout_usrname); 71 layout_left->addLayout(layout_name); 72 layout_left->addLayout(layout_sex); 73 layout_left->addLayout(layout_apartment); 74 layout_left->addLayout(layout_age); 75 layout_left->addLayout(layout_ps); 76 77 layout_usrname->addWidget(label_usrname); 78 layout_usrname->addWidget(text_usrname); 79 80 layout_name->addWidget(label_name); 81 layout_name->addWidget(text_name); 82 83 layout_sex->addWidget(label_sex); 84 layout_sex->addWidget(formatCombo); 85 86 layout_apartment->addWidget(label_apartment); 87 layout_apartment->addWidget(text_apartment); 88 89 layout_age->addWidget(label_age); 90 layout_age->addWidget(text_age); 91 92 layout_ps->addWidget(label_ps); 93 layout_ps->addWidget(text_ps); 94 95 layout_total->addLayout(layout_right); 96 97 layout_right->addLayout(layout_head); 98 layout_right->addWidget(label_instruction); 99 layout_right->addWidget(text_instruction); 100 layout_right->addLayout(layout_btn); 101 102 layout_head->addWidget(label_head); 103 layout_head->addWidget(change); 104 105 layout_btn->addWidget(OK); 106 layout_btn->addWidget(cancel); 107 108 window->setLayout (layout_total); 109 window->show(); 110 return app.exec (); 111 }