本文整理汇总了C++中QDialog::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::connect方法的具体用法?C++ QDialog::connect怎么用?C++ QDialog::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::connect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: diffToPrevious
void VcsEventWidgetPrivate::diffToPrevious()
{
KDevelop::VcsEvent ev = m_logModel->eventForIndex( m_contextIndex );
KDevelop::VcsRevision prev = KDevelop::VcsRevision::createSpecialRevision(KDevelop::VcsRevision::Previous);
KDevelop::VcsJob* job = m_iface->diff( m_url, prev, ev.revision() );
VcsDiffWidget* widget = new VcsDiffWidget( job );
widget->setRevisions( prev, ev.revision() );
QDialog* dlg = new QDialog( q );
widget->connect(widget, &VcsDiffWidget::destroyed, dlg, &QDialog::deleteLater);
dlg->setWindowTitle( i18n("Difference To Previous") );
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
auto mainWidget = new QWidget;
QVBoxLayout *mainLayout = new QVBoxLayout;
dlg->setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
dlg->connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
dlg->connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
mainLayout->addWidget(widget);
mainLayout->addWidget(buttonBox);
dlg->show();
}
示例2: whoWin
void Game_main::whoWin()//直接判断white_win,black_win弹出窗口
{
if(white_win)
{
QDialog *Dblack = new QDialog();
QVBoxLayout *vlayout = new QVBoxLayout;
Dblack->setFixedSize(150,140);
QLabel *label = new QLabel("白棋胜利!");
QAbstractButton *bExit = new QPushButton("再来一局");
bExit->setText("再来一局");
vlayout->addWidget(label);
vlayout->addWidget(bExit);
Dblack->setLayout(vlayout);
Dblack->show();
Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
Dblack->connect(bExit,SIGNAL(clicked()),this,SLOT(start()));
is_over = true;
}
if(black_win)
{
QDialog *Dblack = new QDialog();
QVBoxLayout *vlayout = new QVBoxLayout;
Dblack->setFixedSize(150,140);
QLabel *label = new QLabel("黑棋胜利!");
QAbstractButton *bExit = new QPushButton("再来一局");
bExit->setText("再来一局");
vlayout->addWidget(label);
vlayout->addWidget(bExit);
Dblack->setLayout(vlayout);
Dblack->show();
Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
Dblack->connect(bExit,SIGNAL(clicked()),this,SLOT(start()));
is_over =true;
}
}
示例3: about
/*
*点击“关于”执行此函数
*弹出对话框
*/
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()));
}
示例4: promptUserForAction
CrashHandler::Action CrashHandler::promptUserForAction(bool showCrashMessage) {
QDialog crashDialog;
QLabel* label;
if (showCrashMessage) {
crashDialog.setWindowTitle("Interface Crashed Last Run");
label = new QLabel("If you are having trouble starting would you like to reset your settings?");
} else {
crashDialog.setWindowTitle("Reset Settings");
label = new QLabel("Would you like to reset your settings?");
}
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(label);
QRadioButton* option1 = new QRadioButton("Reset all my settings");
QRadioButton* option2 = new QRadioButton("Reset my settings but keep essential info");
QRadioButton* option3 = new QRadioButton("Continue with my current settings");
option3->setChecked(true);
layout->addWidget(option1);
layout->addWidget(option2);
layout->addWidget(option3);
layout->addSpacing(12);
layout->addStretch();
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok);
layout->addWidget(buttons);
crashDialog.connect(buttons, SIGNAL(accepted()), SLOT(accept()));
crashDialog.setLayout(layout);
int result = crashDialog.exec();
if (result == QDialog::Accepted) {
if (option1->isChecked()) {
return CrashHandler::DELETE_INTERFACE_INI;
}
if (option2->isChecked()) {
return CrashHandler::RETAIN_IMPORTANT_INFO;
}
}
// Dialog cancelled or "do nothing" option chosen
return CrashHandler::DO_NOTHING;
}
示例5: main
//.........这里部分代码省略.........
if(queryFromParts.trimmed()==";")
skipQuery=true;
if(!skipQuery)
{
if (!query.exec(queryFromParts))
{
qCritical() << _T("%1 Ошибка создания новой базы данных\n%2\n%3").arg(posForLog, query.lastError().text(), query.lastQuery());
return 1;
}
// qDebug()<<queryFromParts;
}
queryFromParts.clear();
}
}
QDialog dlg;
QFormLayout layout;
dlg.setLayout(&layout);
QLineEdit posID;
layout.addRow(_T("Код ПОС-а"), &posID);
QLineEdit generatorMin;
layout.addRow(_T("Генератор мин"), &generatorMin);
QLineEdit generatorMax;
layout.addRow(_T("Генератор макс"), &generatorMax);
QPushButton bt;
bt.setText("OK");
layout.addRow(0, &bt);
dlg.connect(&bt, SIGNAL(clicked()), &dlg, SLOT(accept()));
if(dlg.exec()==QDialog::Accepted)
{
query.prepare(settings->value(_S("global/queries/set_pos_id")).toString());
query.bindValue(":val", posID.text().toInt());
if(!query.exec())
{
qCritical() << _T("%1 Ошибка создания новой базы данных\n%2\n%3").arg(posForLog, query.lastError().text(), query.lastQuery());
return 1;
}
query.prepare(settings->value(_S("global/queries/set_generator_min")).toString());
query.bindValue(":val", generatorMin.text().toInt());
if(!query.exec())
{
qCritical() << _T("%1 Ошибка создания новой базы данных\n%2\n%3").arg(posForLog, query.lastError().text(), query.lastQuery());
return 1;
}
query.prepare(settings->value(_S("global/queries/set_generator_min1_sqlite")).toString());
query.bindValue(":val", generatorMin.text().toInt());
if(!query.exec())
{
qCritical() << _T("%1 Ошибка создания новой базы данных\n%2\n%3").arg(posForLog, query.lastError().text(), query.lastQuery());
return 1;
}
query.prepare(settings->value(_S("global/queries/set_generator_min2_sqlite")).toString());
query.bindValue(":val", generatorMin.text().toInt());
if(!query.exec())
{
qCritical() << _T("%1 Ошибка создания новой базы данных\n%2\n%3").arg(posForLog, query.lastError().text(), query.lastQuery());
return 1;
示例6: about_variables
void ProfileDataInfoDialog::about_variables() {
QDialog *dialog = new QDialog(this);
dialog->resize(QSize(700, 480));
dialog->setWindowTitle(i18n("Usable Variables For Text Template"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
dialog->connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
dialog->connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QTextBrowser *tb = new QTextBrowser(dialog);
tb->setHtml(i18n("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">"
"<html>"
"<head>"
"<style type=\"text/css\">"
"p, li { white-space: pre-wrap; }"
"</style>"
"</head>"
"<body>"
"Variables will be replaced by a special value and can even contain parameters.<br />"
"For example the variable "
"<div style=\"font-family:monospace; background: #b3c1d6; color: black\"><pre>"
"$artist"
"</pre></div>"
"or the equivalent"
"<div style=\"font-family:monospace; background: #b3c1d6; color: black\"><pre>"
"${artist}"
"</pre></div>"
"will be replaced by the relevant artist of the cd. Variables may also have attribute, for example:"
"<div style=\"font-family:monospace; background: #b3c1d6; color: black\"><pre>"
"${today format=\"yyyy-MM-dd\"}"
"</pre></div>"
"This would print the current date. Setting the format will control how this is done. The example (above)"
"would result int the date being printed as 2010-10-07 (if this was the current date). See below for more details.<br /><br />"
"You can make use of the following variables:<br />"
"<table border=1>"
"<thead>"
"<tr>"
"<th>Variable</th><th>Parameter</th><th>Description</th><th>Example</th>"
"</tr>"
"</thead>"
"<tbody>"
"<tr>"
"<td>$artist</td><td></td><td>Prints the relevant artist of the extracted cd.</td><td>${artist }</td>"
"</tr>"
"<tr>"
"<td>$title</td><td></td><td>Prints the relevant title of the extracted cd.</td><td></td>"
"</tr>"
"<tr>"
"<td>$date</td><td></td><td>Prints the relevant date (usually release year) of the extracted cd.</td><td></td>"
"</tr>"
"<tr>"
"<td>$genre;</td><td></td><td>Prints the relevant genre of the extracted cd.</td><td></td>"
"</tr>"
"<tr>"
"<td>$size</td><td>iec,precision</td><td>Prints the overall size of all extracted (compressed) music files (incl. the cover). The attribute iec can be one of the following: b, k, m, g. b means byte, k KiB, m MiB and g GiB. The attribute precision gives the number of decimal places. Default attributes are iec=\"m\" and precision=\"2\"</td><td>${size iec=\"k\" precision=\"2\"}</td>"
"</tr>"
"<tr>"
"<td>$length</td><td></td><td>Prints the relevant overall length of all extracted tracks. The format is min:sec.</td><td></td>"
"</tr>"
"<tr>"
"<td>$nooftracks</td><td></td><td>Prints the total number of extracted tracks.</td><td></td>"
"</tr>"
"<tr>"
"<td>$discid</td><td>base</td><td>Prints the discid of the current cd. The attribute base is the base of the number. The default is 16 (hexadecimal).</td><td>${discid base=\"16\"}</td>"
"</tr>"
"<tr>"
"<td>$today</td><td>format</td><td>Prints the current date. The attribute format specifies the output (*).</td><td>${today format=\"yyyy-MM-dddd\"}</td>"
"</tr>"
"<tr>"
"<td>$now</td><td>format</td><td>Prints the current date and/or time. The attribute format specifies the output (*).</td><td>${now format=\"yyyy-MM-dddd hh:mm:ss\"}</td>"
"</tr>"
"<tr>"
"<td>$encoder</td><td></td><td>Prints encoder name and version.</td>"
"</tr>"
"<tr>"
"<td>$audex</td><td></td><td>Prints Audex name and version.</td>"
"</tr>"
"<tr>"
"<td>$br</td><td></td><td>Prints a linebreak.</td><td></td>"
"</tr>"
"</tbody>"
"</table>"
"<br /><br />"
"(* date/time format expressions)"
"<table cellpadding=\"2\" cellspacing=\"1\" border=\"1\">"
"<thead><tr valign=\"top\"><th>Expression</th><th>Output</th></tr></thead>"
"<tr valign=\"top\"><td>d</td><td>The day as a number without a leading zero (1 to 31).</td></tr>"
"<tr valign=\"top\"><td>dd</td><td>The day as a number with a leading zero (01 to 31).</td></tr>"
"<tr valign=\"top\"><td>ddd</td><td>The abbreviated localized day name (e.g. 'Mon' to 'Sun').</td></tr>"
"<tr valign=\"top\"><td>dddd</td><td>The long localized day name (e.g. 'Monday' to 'Sunday').</td></tr>"
"<tr valign=\"top\"><td>M</td><td>The month as a number without a leading zero (1 to 12).</td></tr>"
"<tr valign=\"top\"><td>MM</td><td>The month as a number with a leading zero (01 to 12).</td></tr>"
"<tr valign=\"top\"><td>MMM</td><td>The abbreviated localized month name (e.g. 'Jan' to 'Dec').</td></tr>"
"<tr valign=\"top\"><td>MMMM</td><td>The long localized month name (e.g. 'January' to 'December').</td></tr>"
"<tr valign=\"top\"><td>yy</td><td>The year as two digit number (00 to 99).</td></tr>"
"<tr valign=\"top\"><td>yyyy</td><td>The year as four digit number.</td></tr>"
"</table>"
//.........这里部分代码省略.........