本文整理汇总了C++中QDialog类的典型用法代码示例。如果您正苦于以下问题:C++ QDialog类的具体用法?C++ QDialog怎么用?C++ QDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
/*
*点击“关于”执行此函数
*弹出对话框
*/
void Game_main::about()
{
QDialog *Dblack = new QDialog();
QVBoxLayout *vlayout = new QVBoxLayout;
Dblack->setFixedSize(300,280);
QLabel *label = new QLabel("Copy Right @ UESTC-CCSE wytk2008.net");
QAbstractButton *bExit = new QPushButton("back");
vlayout->addWidget(label);
vlayout->addWidget(bExit);
Dblack->setLayout(vlayout);
Dblack->show();
Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
}
示例2: slotAuthenticationRequired
void DownloadDialog::slotAuthenticationRequired(const QString &hostName, quint16, QAuthenticator *authenticator)
{
QDialog dlg;
Ui_DlgAuthorization ui;
ui.setupUi(&dlg);
dlg.adjustSize();
ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(hostName));
if (dlg.exec() == QDialog::Accepted) {
authenticator->setUser(ui.username->text());
authenticator->setPassword(ui.password->text());
}
}
示例3: currentState
void BazaarPlugin::update()
{
const VCSBase::VCSBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QDialog dialog;
Ui::RevertDialog revertUi;
revertUi.setupUi(&dialog);
dialog.setWindowTitle(tr("Update"));
if (dialog.exec() != QDialog::Accepted)
return;
m_client->update(state.topLevel(), revertUi.revisionLineEdit->text());
}
示例4: displayException
void ExpTranWindow::displayException(const std::exception &e)
{
QDialog d;
QVBoxLayout *layout = new QVBoxLayout();
QTextBrowser *browser = new QTextBrowser;
QString str = e.what();
browser->setText(str);
layout->addWidget(browser);
d.setLayout(layout);
d.setWindowTitle("Error");
d.exec();
}
示例5: on_action_Manage_WMS_Connection_triggered
void SWGISBrowser::on_action_Manage_WMS_Connection_triggered()
{
QDialog *wmsDialog = dynamic_cast<QDialog*>(QgsProviderRegistry::instance()->selectWidget(QString("wms")));
if(!wmsDialog)
{
QMessageBox::warning(this, tr("WMS"), tr("Cannot get WMS select dialog from provider!"));
return;
}
wmsDialog->exec();
delete wmsDialog;
this->refresh();
}
示例6: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();
QDialog *dialog = new QDialog();
Ui_Dialog *ui_dialog = new Ui_Dialog();
ui_dialog->setupUi(dialog);
dialog->show();
return app.exec();
}
示例7: AboutShow
void MainWindow::AboutShow()
{
QDialog *aboutDialog = new QDialog;
QLabel *aboutLabel = new QLabel;
QString titleString = "关于";
aboutDialog->setWindowTitle(titleString);
aboutDialog->setWindowIcon(QIcon("://icon/infoIcon.png"));
aboutLabel = new QLabel(aboutDialog);
QPixmap contentPix("://icon/aboutText.png");
aboutLabel->setPixmap(contentPix);
aboutLabel->show();
aboutDialog->exec();
}
示例8: WarningShow
void MainWindow::WarningShow()
{
QDialog *warningDialog = new QDialog;
QLabel *warningLabel = new QLabel;
QString titleString = "Warning";
warningDialog->setWindowTitle(titleString);
warningDialog->setWindowIcon(QIcon("://icon/infoIcon.png"));
warningLabel = new QLabel(warningDialog);
QPixmap contentPix("://icon/warningText.png");
warningLabel->setPixmap(contentPix);
warningLabel->show();
warningDialog->exec();
}
示例9: on_actionHelpAbout_triggered
void MainWindow::on_actionHelpAbout_triggered()
{
QDialog *aboutDialog = new QDialog;
Ui::About about;
about.setupUi(aboutDialog);
about.versionLabel->setText(
QString("Version: %1 Revision: %2").arg(version).arg(revision));
aboutDialog->exec();
delete aboutDialog;
}
示例10: main
int main (int argc, char ** argv) {
QApplication app(argc, argv);
QDialog * dial = new QDialog();
QVBoxLayout * mainlayout = new QVBoxLayout(dial);
mainlayout->addLayout(getInputForm(dial,"firstname"));
mainlayout->addLayout(getInputForm(dial,"lastname"));
mainlayout->addLayout(getInputForm(dial,"phone"));
mainlayout->addLayout(getInputForm(dial,"email"));
mainlayout->addWidget(new QPushButton("send to db",dial));
dial->setLayout(mainlayout);
dial->show();
return app.exec();
}
示例11: QDialog
void MainWindow::on_action_Find_triggered()
{
QDialog *findDlg = new QDialog(this);
findDlg->setWindowTitle(tr("查找"));
find_textLineEdit = new QLineEdit(findDlg);
QPushButton *find_Btn = new QPushButton(tr("查找下一个"),findDlg);
QVBoxLayout* layout = new QVBoxLayout(findDlg);
layout->addWidget(find_textLineEdit);
layout->addWidget(find_Btn);
findDlg->show();
connect(find_Btn,SIGNAL(clicked()),this,SLOT(show_findText()));
second_statusLabel->setText(tr("正在进行查找"));
}
示例12: GuideShow
void MainWindow::GuideShow()
{
QDialog *guideDialog = new QDialog;
QLabel *guideLabel = new QLabel;
QString titleString = "使用说明";
guideDialog->setWindowTitle(titleString);
guideDialog->setWindowIcon(QIcon("://icon/helpIcon.png"));
guideLabel = new QLabel(guideDialog);
QPixmap contentPix("://icon/welcomeText.jpg");
guideLabel->setPixmap(contentPix);
guideLabel->show();
guideDialog->exec();
}
示例13: showRegExpDialog
void SingleConditionWidget::showRegExpDialog()
{
QDialog *editorDialog =
KParts::ComponentFactory::createPartInstanceFromQuery<QDialog>(
"KRegExpEditor/KRegExpEditor", QString() );
if ( editorDialog ) {
KRegExpEditorInterface *editor = qobject_cast<KRegExpEditorInterface *>( editorDialog );
Q_ASSERT( editor ); // This should not fail!
editor->setRegExp( expr->text() );
editorDialog->exec();
expr->setText( editor->regExp() );
}
}
示例14: installAction
void InstallDialog::SlotOkButtonClicked()
{
Action installAction("org.kde.kcontrol.kcmgrub2.install");
installAction.setHelperId("org.kde.kcontrol.kcmgrub2");
for (int i = 0; i < ui->treeWidget_recover->topLevelItemCount(); i++) {
QRadioButton *radio = qobject_cast<QRadioButton *>(ui->treeWidget_recover->itemWidget(ui->treeWidget_recover->topLevelItem(i), 0));
if (radio && radio->isChecked()) {
installAction.addArgument("partition", ui->treeWidget_recover->topLevelItem(i)->text(1));
installAction.addArgument("mountPoint", ui->treeWidget_recover->topLevelItem(i)->text(2));
installAction.addArgument("mbrInstall", !ui->checkBox_partition->isChecked());
break;
}
}
if (installAction.arguments().value("partition").toString().isEmpty()) {
KMessageBox::sorry(this, i18nc("@info", "Sorry, you have to select a partition with a proper name!"));
return;
}
QProgressDialog progressDlg(this, Qt::Dialog);
progressDlg.setWindowTitle(i18nc("@title:window", "Installing"));
progressDlg.setLabelText(i18nc("@info:progress", "Installing GRUB..."));
progressDlg.setCancelButton(0);
progressDlg.setModal(true);
progressDlg.setRange(0,0);
progressDlg.show();
ExecuteJob* reply = installAction.execute();
reply->exec();
if (reply->action().status() != Action::AuthorizedStatus ) {
progressDlg.hide();
return;
}
//connect(reply, SIGNAL(result()), &progressDlg, SLOT(hide()));
progressDlg.hide();
if (reply->error()) {
KMessageBox::detailedError(this, i18nc("@info", "Failed to install GRUB."), reply->data().value("errorDescription").toString());
this->reject();
} else {
progressDlg.hide();
QDialog *dialog = new QDialog(this, Qt::Dialog);
dialog->setWindowTitle(i18nc("@title:window", "Information"));
dialog->setModal(true);
QDialogButtonBox *btnbox = new QDialogButtonBox(QDialogButtonBox::Ok);
KMessageBox::createKMessageBox(dialog, btnbox, QMessageBox::Information, i18nc("@info", "Successfully installed GRUB."), QStringList(), QString(), 0, KMessageBox::Notify, reply->data().value("output").toString()); // krazy:exclude=qclasses
this->accept();
}
//this->accept();
}
示例15: fits_get_errstatus
void FITSTab::headerFITS()
{
QString recordList;
int nkeys;
int err_status;
char err_text[FLEN_STATUS];
FITSImage *image_data = image->getImageData();
if ( (err_status = image_data->getFITSRecord(recordList, nkeys)) < 0)
{
fits_get_errstatus(err_status, err_text);
KMessageBox::error(0, i18n("FITS record error: %1", QString::fromUtf8(err_text)), i18n("FITS Header"));
return;
}
//FIXME: possible crash! Must use QPointer<...>!
QDialog fitsHeaderDialog;
Ui::fitsHeaderDialog header;
header.setupUi(&fitsHeaderDialog);
header.tableWidget->setRowCount(nkeys);
for(int i = 0; i < nkeys; i++)
{
QString record = recordList.mid(i*80, 80);
// I love regexp!
QStringList properties = record.split(QRegExp("[=/]"));
QTableWidgetItem* tempItem = new QTableWidgetItem(properties[0].simplified());
tempItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
header.tableWidget->setItem(i, 0, tempItem);
if (properties.size() > 1)
{
tempItem = new QTableWidgetItem(properties[1].simplified());
tempItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
header.tableWidget->setItem(i, 1, tempItem);
}
if (properties.size() > 2)
{
tempItem = new QTableWidgetItem(properties[2].simplified());
tempItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
header.tableWidget->setItem(i, 2, tempItem);
}
}
header.tableWidget->resizeColumnsToContents();
fitsHeaderDialog.exec();
}