PasscodeWidget::PasscodeWidget(QWidget *parent) : QWidget(parent), _passcode(this, st::passcodeInput), _submit(this, lang(lng_passcode_submit), st::passcodeSubmit), _logout(this, lang(lng_passcode_logout)) { setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight)); connect(App::wnd(), SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &))); _passcode.setEchoMode(QLineEdit::Password); connect(&_submit, SIGNAL(clicked()), this, SLOT(onSubmit())); connect(&_passcode, SIGNAL(changed()), this, SLOT(onChanged())); connect(&_passcode, SIGNAL(accepted()), this, SLOT(onSubmit())); connect(&_logout, SIGNAL(clicked()), App::wnd(), SLOT(onLogout())); show(); _passcode.setFocus(); }
PasscodeWidget::PasscodeWidget(QWidget *parent) : TWidget(parent) , _passcode(this, st::passcodeInput, lang(lng_passcode_ph)) , _submit(this, lang(lng_passcode_submit), st::passcodeSubmit) , _logout(this, lang(lng_passcode_logout)) { connect(_passcode, SIGNAL(changed()), this, SLOT(onChanged())); connect(_passcode, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); _submit->setClickedCallback([this] { onSubmit(); }); _logout->setClickedCallback([] { App::wnd()->onLogout(); }); show(); }
dtkDistributedControllerSubmitView::dtkDistributedControllerSubmitView(QWidget *parent) : QFrame(parent), d(new dtkDistributedControllerSubmitViewPrivate) { d->controller = NULL; d->application = "dtkComposerEvaluatorSlave"; d->node_spin = new QSpinBox(this); d->node_spin->setMinimum(1); d->node_spin->setMaximum(500); d->node_spin->setSingleStep(1); d->node_spin->setValue(1); d->node_spin->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); d->ppn_spin = new QSpinBox(this); d->ppn_spin->setMinimum(1); d->ppn_spin->setMaximum(500); d->ppn_spin->setSingleStep(1); d->ppn_spin->setValue(1); d->ppn_spin->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); d->time_edit = new QDateTimeEdit(this); d->time_edit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); d->time_edit->setDisplayFormat("hh:mm:ss"); d->time_edit->setTime(QTime(0, 15, 0)); d->submit_button = new QPushButton("Submit", this); QFormLayout *f_layout = new QFormLayout; f_layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); f_layout->addRow("Nodes", d->node_spin); f_layout->addRow("Process per node", d->ppn_spin); f_layout->addRow("Duration", d->time_edit); f_layout->addRow(d->submit_button); QLabel *header = new QLabel("Submission", this); header->setObjectName("dtkDistributedControllerSubmitViewHeader"); QHBoxLayout *t_layout = new QHBoxLayout; t_layout->addWidget(header); QWidget *bottom = new QWidget(this); bottom->setLayout(f_layout); QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addWidget(header); layout->addWidget(bottom); connect(d->submit_button, SIGNAL(clicked()), this, SLOT(onSubmit())); this->setEnabled(false); }
void Widget::setupUI() { const char* questions[] = { "1. 我知道对我的工作要求吗?", "2. 我有做好我的工作所需要的\n材料和设备吗?", "3. 在工作中,我每天都有机会\n做我最擅长做的事吗?", "4. 在过去的七天里,我因工作\n出色而受到表扬吗?", "5. 我觉得我的主管或同事关心\n我的个人情况吗?", "6. 工作单位有人鼓励我的发展吗?", "7. 在工作中,我觉得我的意见受\n到重视吗?", "8. 公司的使命目标使我觉得我的\n工作重要吗?", "9. 我的同事们致力于高质量的工作吗?", "10. 我在工作单位有一个最要好的\n朋友吗?", "11. 在过去的六个月内,工作单位\n有人和我谈及我的进步吗?", "12. 过去一年里,我在工作中有机会\n学习和成长吗?" }; m_nQuestionCount = sizeof(questions)/sizeof(questions[0]); m_scores = new QComboBox*[m_nQuestionCount]; QVBoxLayout *mainLayout = new QVBoxLayout(this); QHBoxLayout *line; QLabel * question; QComboBox *score; QStringList scoreList("0"); scoreList << "1" << "2" << "3" << "4" << "5"; for(int i = 0; i < m_nQuestionCount; i++) { line = new QHBoxLayout(); question = new QLabel(questions[i], this); line->addWidget(question, 4, Qt::AlignLeft | Qt::AlignVCenter); score = new QComboBox(this); score->addItems(scoreList); score->setCurrentIndex(3); line->addWidget(score, 1, Qt::AlignRight | Qt::AlignVCenter); m_scores[i] = score; mainLayout->addLayout(line); } QPushButton * submit = new QPushButton("提交", this); connect(submit, SIGNAL(clicked()), this, SLOT(onSubmit())); QPushButton * cancel = new QPushButton("取消", this); connect(cancel, SIGNAL(clicked()), qApp, SLOT(quit())); line = new QHBoxLayout(); line->addStretch(1); line->addWidget(cancel, 0, Qt::AlignRight | Qt::AlignVCenter); line->addWidget(submit, 0, Qt::AlignRight | Qt::AlignVCenter); mainLayout->addLayout(line); }
ApplyDialog::ApplyDialog(QWidget* parent, PageId const& cur_page, PageSelectionAccessor const& page_selection_accessor) : QDialog(parent), m_pages(page_selection_accessor.allPages()), m_selectedPages(page_selection_accessor.selectedPages()), m_curPage(cur_page), m_pScopeGroup(new QButtonGroup(this)) { setupUi(this); m_pScopeGroup->addButton(thisPageRB); m_pScopeGroup->addButton(allPagesRB); m_pScopeGroup->addButton(thisPageAndFollowersRB); m_pScopeGroup->addButton(selectedPagesRB); if (m_selectedPages.size() <= 1) { selectedPagesWidget->setEnabled(false); } connect(buttonBox, SIGNAL(accepted()), this, SLOT(onSubmit())); }
tstMainWindow::tstMainWindow(QWidget *parent) : QMainWindow(parent) { d = new tstMainWindowPrivate; d->controller = new dtkDistributedController; d->status_model = new dtkDistributedControllerStatusModel(this); d->status_model->setController(d->controller); d->status_view = new dtkDistributedControllerStatusView(this); d->status_view->setModel(d->status_model); d->host_address = new QLineEdit("dtk://nef-devel.inria.fr:9999", this); d->host_address->setAttribute(Qt::WA_MacShowFocusRect, false); d->host_button = new QPushButton("Connect", this); d->host_button->setAttribute(Qt::WA_MacShowFocusRect, false); d->host_button->setFixedWidth(200); d->submit_nodes = new QSpinBox(this); d->submit_nodes->setMaximum(100); d->submit_nodes->setValue(2); d->submit_cores = new QSpinBox(this); d->submit_cores->setMaximum(48); d->submit_cores->setValue(8); d->submit_value = new QSpinBox(this); d->submit_value->setMaximum(100000); d->submit_value->setValue(100000); d->submit_button = new QPushButton("Submit", this); d->submit_button->setAttribute(Qt::WA_MacShowFocusRect, false); d->submit_button->setFixedWidth(200); QHBoxLayout *host_layout = new QHBoxLayout; host_layout->addWidget(d->host_address); host_layout->addWidget(d->host_button); QHBoxLayout *submit_layout = new QHBoxLayout; submit_layout->addWidget(d->submit_nodes); submit_layout->addWidget(d->submit_cores); submit_layout->addWidget(d->submit_value); submit_layout->addWidget(d->submit_button); QWidget *host_widget = new QWidget(this); host_widget->setLayout(host_layout); QWidget *submit_widget = new QWidget(this); submit_widget->setLayout(submit_layout); QWidget *central = new QWidget(this); QVBoxLayout *central_layout = new QVBoxLayout(central); central_layout->setContentsMargins(0, 0, 0, 0); central_layout->setSpacing(0); central_layout->addWidget(host_widget); central_layout->addWidget(d->status_view); central_layout->addWidget(submit_widget); this->setCentralWidget(central); this->setUnifiedTitleAndToolBarOnMac(true); this->setWindowTitle("dtkDistributedTutorial - Step #6"); connect(d->host_button, SIGNAL(clicked()), this, SLOT(onConnect())); connect(d->submit_button, SIGNAL(clicked()), this, SLOT(onSubmit())); connect(d->controller, SIGNAL(dataPosted(const QByteArray&)), this, SLOT(onDataPosted(const QByteArray&))); connect(d->controller, SIGNAL(jobStarted(QString)), this, SLOT(onJobStarted(QString))); }