remfiledlg.cpp

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

CPP
69
字号
#include "remfiledlg.h"#include <qpushbutton.h>#include <qlabel.h>#include <qlayout.h>#include <qhbox.h>#include <qstringlist.h>#include <qmessagebox.h>#include "defdoc.xpm"RemoveFileDlg::RemoveFileDlg(QWidget *parent, HideProj *proj)	: QDialog(parent, 0, true){	m_pHideProj = proj;	QVBoxLayout *vbox = new QVBoxLayout(this);	m_listFiles = new QListBox(this);	QHBox *hbox = new QHBox(this);	hbox->setMaximumWidth(200);		QPushButton *ok = new QPushButton("Remove", hbox);	QPushButton *cancel = new QPushButton("Cancel", hbox);	vbox->addWidget(m_listFiles);	vbox->addWidget(hbox);	vbox->setSpacing(5);	QStringList *pList = m_pHideProj->getFileList();	for (unsigned i=0; i < pList->count(); i++)		m_listFiles->insertItem(QPixmap(const_cast<const char **>(defdoc)), (*pList)[i]);	setMaximumWidth(475);		resize(475, height());	QObject::connect(ok, SIGNAL(clicked()), this, SLOT(verify()));	QObject::connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));	ok->setDefault(true);	setCaption("Remove Project File");}int RemoveFileDlg::exec(){	return QDialog::exec();}void RemoveFileDlg::verify(){	if (m_listFiles->currentText().isEmpty())	{		QMessageBox::warning(this, "hIDE", "Please choose a file to remove/");		return;	}	m_pHideProj->removeFile(m_listFiles->currentText());	m_pHideProj->save();	accept();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?