📄 addtooldlg.cpp
字号:
#include "addtooldlg.h"#include <qpushbutton.h>#include <qlayout.h>#include <qhbox.h>#include <qlabel.h>#include <qmessagebox.h>AddToolDlg::AddToolDlg(QWidget *parent, const char *name) : QDialog(parent, name){ m_editTool = m_editAlias = NULL; QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setSpacing(5); QHBox *hbox = new QHBox(this); hbox->setMaximumWidth(200); m_editTool = new QLineEdit(this); m_editAlias = new QLineEdit(this); vbox->addWidget(new QLabel("Tool", this)); vbox->addWidget(m_editTool); vbox->addWidget(new QLabel("Menu Alias", this)); vbox->addWidget(m_editAlias); QPushButton *ok = new QPushButton("Add", hbox); ok->setDefault(true); QPushButton *cancel = new QPushButton("Cancel", hbox); QObject::connect(ok, SIGNAL(clicked()), this, SLOT(verify())); QObject::connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); vbox->addWidget(hbox); setCaption("Add Tool");}int AddToolDlg::exec(){ return QDialog::exec();}void AddToolDlg::verify(){ if (m_editTool->text() == "") { QMessageBox::information(this, "Missing Tool", "You must enter the name of this tool."); m_editTool->setFocus(); return; } if (m_editAlias->text() == "") { QMessageBox::information(this, "Missing Alias", "You must enter a menu alias for this tool."); m_editAlias->setFocus(); return; } accept();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -