addtooldlg.cpp

来自「Linux下的C、C++ IDE」· C++ 代码 · 共 71 行

CPP
71
字号
#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 + =
减小字号Ctrl + -
显示快捷键?