本文整理汇总了C++中QDialogButtonBox::addButton方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialogButtonBox::addButton方法的具体用法?C++ QDialogButtonBox::addButton怎么用?C++ QDialogButtonBox::addButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox::addButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setApplicationName(app.translate("main", "Matrix Quiz"));
#ifdef Q_WS_MAC
app.setCursorFlashTime(0);
#endif
qsrand(static_cast<uint>(time(0)));
QWebSettings *webSettings = QWebSettings::globalSettings();
webSettings->setAttribute(QWebSettings::AutoLoadImages, true);
webSettings->setAttribute(QWebSettings::JavascriptEnabled, true);
webSettings->setAttribute(QWebSettings::PluginsEnabled, true);
QString url = QUrl::fromLocalFile(AQP::applicationPathOf() +
"/matrixquiz.html").toString();
BrowserWindow *browser = new BrowserWindow(url, new WebPage);
browser->showToolBar(false);
browser->enableActions(false);
QDialogButtonBox *buttonBox = new QDialogButtonBox;
QPushButton *quitButton = buttonBox->addButton(
app.translate("main", "&Quit"),
QDialogButtonBox::AcceptRole);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(browser, 1);
layout->addWidget(buttonBox);
QDialog dialog;
dialog.setLayout(layout);
QObject::connect(quitButton, SIGNAL(clicked()),
&dialog, SLOT(accept()));
dialog.setWindowTitle(app.applicationName());
dialog.show();
return app.exec();
}
示例2: QDialog
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
{
setWindowIcon(GuiRegistry::instance().mainWindowIcon());
setWindowTitle("About "PROJECT_NAME_TITLE);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
QIcon icon = GuiRegistry::instance().mainWindowIcon();
QPixmap iconPixmap = icon.pixmap(48, 48);
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(iconPixmap);
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例3: BtConfigDialog
BtModuleManagerDialog::BtModuleManagerDialog(QWidget* parent)
: BtConfigDialog(parent) {
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(tr("Bookshelf Manager"));
// Install page
BtInstallPage* installPage = new BtInstallPage();
addPage(installPage);
//Uninstall page
BtRemovePage* removePage = new BtRemovePage();
addPage(removePage);
//Index page
BtIndexPage* indexPage = new BtIndexPage();
addPage(indexPage);
slotChangePage(0);
// Dialog button (Close)
QDialogButtonBox* bbox = new QDialogButtonBox(this);
bbox->addButton(QDialogButtonBox::Close);
util::prepareDialogBox(bbox);
addButtonBox(bbox);
connect(bbox, SIGNAL(rejected()), SLOT(close()));
loadDialogSettings();
}
示例4: QDialog
PeakColorDlg::PeakColorDlg(QWidget *parent) :
QDialog(parent)
{
setWindowTitle( tr("Set Peak Colors - CARA") );
QVBoxLayout* vbox = new QVBoxLayout(this);
d_list = new QListWidget( this );
d_list->setViewMode( QListView::IconMode );
d_list->setResizeMode(QListView::Adjust);
d_list->setUniformItemSizes(true);
d_list->setWrapping(true);
vbox->addWidget( d_list );
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this );
vbox->addWidget( bb );
connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
QPushButton* b = bb->addButton( tr("Set Color"), QDialogButtonBox::ActionRole );
b->setEnabled(false);
connect( b, SIGNAL(clicked()), this, SLOT(onColor()) );
connect( d_list, SIGNAL(itemSelectionChanged()), this, SLOT(onSelection()) );
connect( this, SIGNAL(oneSelected(bool)), b,SLOT(setEnabled(bool)) );
connect( d_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)),this, SLOT(onColor()) );
setMinimumSize(400,300);
}
示例5: QDialog
MMSendDlg::MMSendDlg(MMUserView* _mmv, QWidget* p)
: QDialog(p),
mmv(_mmv),
icqEventTag(0)
{
Support::setWidgetProps(this, "MMSendDialog");
setAttribute(Qt::WA_DeleteOnClose, true);
QVBoxLayout* v = new QVBoxLayout(this);
grpSending = new QGroupBox();
QVBoxLayout* laySending = new QVBoxLayout(grpSending);
barSend = new QProgressBar();
laySending->addWidget(barSend);
QDialogButtonBox* buttons = new QDialogButtonBox();
btnCancel = buttons->addButton(QDialogButtonBox::Cancel);
v->addWidget(grpSending);
v->addWidget(buttons);
connect(btnCancel, SIGNAL(clicked()), SLOT(slot_cancel()));
connect(gGuiSignalManager, SIGNAL(doneUserFcn(const Licq::Event*)),
SLOT(slot_done(const Licq::Event*)));
barSend->setMaximum(mmv->contacts().size());
barSend->setValue(0);
setMinimumWidth(300);
}
示例6: QDialog
AddDialog::AddDialog(PlantsModel* plants_model, QWidget* parent) :
plants_model(plants_model), QDialog(parent)
{
setModal(true);
QFormLayout* formLayout = new QFormLayout(this);
nameInput = new QLineEdit();
formLayout->addRow(tr("Name :"), nameInput);
QPushButton* OKbutton = new QPushButton(tr("Add"));
QPushButton* Canbutton = new QPushButton(tr("Cancel"));
QDialogButtonBox* buttonBox = new QDialogButtonBox();
buttonBox->addButton(OKbutton, QDialogButtonBox::AcceptRole);
buttonBox->addButton(Canbutton, QDialogButtonBox::RejectRole);
formLayout->addRow(buttonBox);
QObject::connect(Canbutton, SIGNAL(clicked()), this, SLOT(hide()));
QObject::connect(OKbutton, SIGNAL(clicked()), this, SLOT(add()));
}
示例7: QListWidgetItem
CreateFeatureDialog::CreateFeatureDialog(QWidget * parent, osm::NewFeatureCategories & cats)
: QDialog(parent)
{
cats.AddLanguage("en"); // Default.
cats.AddLanguage(languages::GetCurrentNorm());
QListWidget * allSortedList = new QListWidget();
auto const & typeNames = cats.GetAllCreatableTypeNames();
for (auto const & name : typeNames)
{
new QListWidgetItem(name.c_str() /* name */, allSortedList);
}
connect(allSortedList, SIGNAL(clicked(QModelIndex const &)), this,
SLOT(OnListItemSelected(QModelIndex const &)));
QDialogButtonBox * dbb = new QDialogButtonBox();
dbb->addButton(QDialogButtonBox::Close);
connect(dbb, SIGNAL(clicked(QAbstractButton *)), this, SLOT(reject()));
QVBoxLayout * vBox = new QVBoxLayout();
vBox->addWidget(allSortedList);
vBox->addWidget(dbb);
setLayout(vBox);
setWindowTitle("OSM Editor");
}
示例8: QDialog
Dialog::Dialog(QWidget *parent, Form *form, std::string topText, std::string confirmButtonText, std::string cancelButtonText)
: QDialog(parent)
{
this->form = form;
setFixedWidth(500);
setModal(true);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(new QLabel(QString::fromStdString(topText)));
if (form != nullptr) {
layout->addSpacing(15);
layout->addWidget(new HorizontalSeperator(QColor(200, 200, 200), 1));
layout->addSpacing(15);
layout->addWidget(form);
}
layout->addSpacing(15);
layout->addWidget(new HorizontalSeperator(QColor(200, 200, 200), 1));
layout->addSpacing(15);
cancelButton = new QPushButton(QString::fromStdString(cancelButtonText));
confirmButton = new QPushButton(QString::fromStdString(confirmButtonText));
QDialogButtonBox *dialogButtonBox = new QDialogButtonBox();
dialogButtonBox->addButton(cancelButton, QDialogButtonBox::RejectRole);
dialogButtonBox->addButton(confirmButton, QDialogButtonBox::AcceptRole);
layout->addWidget(dialogButtonBox);
connect(dialogButtonBox, SIGNAL(accepted()), this, SIGNAL(accepted()));
connect(dialogButtonBox, SIGNAL(rejected()), this, SIGNAL(rejected()));
if (form != nullptr) {
connect(form, SIGNAL(valid()), this, SLOT(formValid()));
connect(form, SIGNAL(invalid()), this, SLOT(formInvalid()));
}
}
示例9: proxyAuthentication
void NetworkManager::proxyAuthentication(const QString &proxyHost, QAuthenticator *auth, QWidget *parent)
{
const QNetworkProxy proxy = QNetworkProxy::applicationProxy();
if (!proxy.user().isEmpty() && !proxy.password().isEmpty()) {
auth->setUser(proxy.user());
auth->setPassword(proxy.password());
return;
}
QDialog* dialog = new QDialog(parent);
dialog->setWindowTitle(tr("Proxy authorisation required"));
QFormLayout* formLa = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLabel* userLab = new QLabel(dialog);
QLabel* passLab = new QLabel(dialog);
userLab->setText(tr("Username: "));
passLab->setText(tr("Password: "));
QLineEdit* user = new QLineEdit(dialog);
QLineEdit* pass = new QLineEdit(dialog);
pass->setEchoMode(QLineEdit::Password);
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("A username and password are being requested by proxy %1. ").arg(proxyHost));
formLa->addRow(label);
formLa->addRow(userLab, user);
formLa->addRow(passLab, pass);
formLa->addWidget(box);
if (dialog->exec() != QDialog::Accepted) {
*auth = QAuthenticator();
delete dialog;
return;
}
auth->setUser(user->text());
auth->setPassword(pass->text());
delete dialog;
}
示例10: QDialog
VersionDialog::VersionDialog(QWidget *parent)
: QDialog(parent)
{
// We need to set the window icon explicitly here since for some reason the
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
setWindowTitle(tr("About OpenPilot GCS"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QString version = QLatin1String(GCS_VERSION_LONG);
version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate);
QString ideRev;
#ifdef GCS_REVISION
//: This gets conditionally inserted as argument %8 into the description string.
ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(GCS_REVISION_STR).left(10));
#endif
const QString description = tr(
"<h3>OpenPilot GCS %1</h3>"
"Based on Qt %2 (%3 bit)<br/>"
"<br/>"
"Built on %4 at %5<br />"
"<br/>"
"%8"
"<br/>"
"Copyright 2008-%6 %7. All rights reserved.<br/>"
"<br/>"
"<small>This program is free software; you can redistribute it and/or modify<br/>"
"it under the terms of the GNU General Public License as published by<br/>"
"the Free Software Foundation; either version 3 of the License, or<br/>"
"(at your option) any later version.<br/><br/>"
"The program is provided AS IS with NO WARRANTY OF ANY KIND, "
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
"PARTICULAR PURPOSE.</small><br/>")
.arg(version, QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize),
QLatin1String(__DATE__), QLatin1String(__TIME__), QLatin1String(GCS_YEAR),
(QLatin1String(GCS_AUTHOR)), ideRev);
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
QTC_ASSERT(closeButton, /**/);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/openpilot_logo_128.png")));
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例11: QDialog
CrashReporter::CrashReporter(QWidget *p) : QDialog(p) {
setWindowTitle(tr("Mumble Crash Report"));
QVBoxLayout *vbl= new QVBoxLayout(this);
QLabel *l;
l = new QLabel(tr("<p><b>We're terribly sorry, but it seems Mumble has crashed. Do you want to send a crash report to the Mumble developers?</b></p>"
"<p>The crash report contains a partial copy of Mumble's memory at the time it crashed, and will help the developers fix the problem.</p>"));
vbl->addWidget(l);
QHBoxLayout *hbl = new QHBoxLayout();
qleEmail = new QLineEdit(g.qs->value(QLatin1String("crashemail")).toString());
l = new QLabel(tr("Email address (optional)"));
l->setBuddy(qleEmail);
hbl->addWidget(l);
hbl->addWidget(qleEmail, 1);
vbl->addLayout(hbl);
qteDescription=new QTextEdit();
l->setBuddy(qteDescription);
l = new QLabel(tr("Please describe briefly, in English, what you were doing at the time of the crash"));
vbl->addWidget(l);
vbl->addWidget(qteDescription, 1);
QPushButton *pbOk = new QPushButton(tr("Send Report"));
pbOk->setDefault(true);
QPushButton *pbCancel = new QPushButton(tr("Don't send report"));
pbCancel->setAutoDefault(false);
QDialogButtonBox *dbb = new QDialogButtonBox(Qt::Horizontal);
dbb->addButton(pbOk, QDialogButtonBox::AcceptRole);
dbb->addButton(pbCancel, QDialogButtonBox::RejectRole);
connect(dbb, SIGNAL(accepted()), this, SLOT(accept()));
connect(dbb, SIGNAL(rejected()), this, SLOT(reject()));
vbl->addWidget(dbb);
qelLoop = new QEventLoop(this);
qpdProgress = NULL;
qnrReply = NULL;
}
示例12: QDialog
NErrorWhileDialog::NErrorWhileDialog(const QStringList& args,
const QString& errmsg,
const int errcode,
QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *box = new QVBoxLayout;
// Label
QLabel *l = new QLabel(label(ErrorWhileRunning));
box->addWidget(l);
// Command args
QPlainTextEdit *t = new QPlainTextEdit(this);
t->setPlainText(args.join(" "));
t->setReadOnly(true);
box->addWidget(t);
// Label
l = new QLabel(label(ErrorMessageFollows));
box->addWidget(l);
// Error message
t = new QPlainTextEdit(this);
const QString s = label(ErrorCode, QString("%1").arg(errcode));
t->setPlainText(QString("%1\n%2").arg(errmsg).arg(s));
t->setReadOnly(true);
box->addWidget(t);
// Button box
QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
QPushButton *b = new QPushButton(tr("Co&py"));
b->setToolTip(tr("Copy to clipboard"));
bb->addButton(b, QDialogButtonBox::ActionRole);
connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
connect(b, SIGNAL(clicked()), this, SLOT(copy()));
box->addWidget(bb);
// Window
setFixedSize(QSize(400,340));
setWindowTitle(tr("Error"));
setLayout(box);
show();
// Save
_errcode = errcode;
_errmsg = errmsg;
_args = args;
}
示例13: setWindowTitle
db_error_dialog::db_error_dialog(const QString error) : m_error_text(error)
{
setWindowTitle(tr("Database error"));
QVBoxLayout* layout = new QVBoxLayout(this);
setMinimumWidth(400); // reasonable minimum
QPlainTextEdit* label = new QPlainTextEdit;
label->setPlainText(error);
label->setReadOnly(true);
label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
label->setFrameShape(QFrame::Box);
label->setFrameShadow(QFrame::Raised);
layout->addWidget(label);
m_btn_group = new QButtonGroup(this);
QButtonGroup* g = m_btn_group;
QRadioButton* btn1 = new QRadioButton(tr("Continue"));
g->addButton(btn1, 1);
btn1->setChecked(true);
QRadioButton* btn2 = new QRadioButton(tr("Try to reconnect"));
g->addButton(btn2, 2);
QRadioButton* btn3 = new QRadioButton(tr("Quit application"));
g->addButton(btn3, 3);
layout->addWidget(btn1);
layout->addWidget(btn2);
layout->addWidget(btn3);
QPushButton* btn_OK = new QPushButton(tr("OK"));
btn_OK->setDefault(true);
QPushButton* copy_btn = new QPushButton(tr("Copy"));
QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal);
buttonBox->addButton(copy_btn, QDialogButtonBox::ActionRole);
buttonBox->addButton(btn_OK, QDialogButtonBox::AcceptRole);
layout->addWidget(buttonBox);
connect(copy_btn, SIGNAL(clicked()), this, SLOT(copy_error()));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(this, SIGNAL(accepted()), this, SLOT(handle_error()));
}
示例14: QDialog
ServiceViewer::ServiceViewer(Plasma::DataEngine *engine, const QString &source, QWidget *parent)
: QDialog(parent),
m_engine(engine),
m_service(0),
m_source(source),
m_operationCount(0),
m_operationButton(new QPushButton(i18n("Start Operation"), this))
{
setAttribute(Qt::WA_DeleteOnClose);
QWidget* mainWidget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout();
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
buttonBox->addButton(m_operationButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
layout->addWidget(mainWidget);
layout->addWidget(buttonBox);
setLayout(layout);
setupUi(mainWidget);
m_operationStatus->hide();
connect(m_operationButton, SIGNAL(clicked()), this, SLOT(startOperation()));
m_operationButton->setEnabled(false);
connect(m_operations, SIGNAL(currentIndexChanged(QString)),
this, SLOT(operationSelected(QString)));
QString engineName = i18nc("Plasma engine with unknown name", "Unknown");
QString serviceName = i18nc("Plasma service with unknown name", "Unknown");
if (m_engine) {
engineName = KStringHandler::capwords(m_engine->pluginInfo().name());
qDebug() << "########### CALLING SERVICE FOR SOURCE: " << m_source;
m_service = m_engine->serviceForSource(m_source);
if (m_service != 0) {
serviceName = m_service->name();
updateOperations();
connect(m_service, SIGNAL(operationsChanged()), this, SLOT(updateOperations()));
connect(m_engine, SIGNAL(destroyed(QObject*)), this, SLOT(engineDestroyed()));
} else {
示例15: configureForExport
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportFeatureImpl::configureForExport(caf::PdmUiPropertyViewDialog* propertyViewDialog)
{
QDialogButtonBox* dialogButtonBox = propertyViewDialog->dialogButtonBox();
dialogButtonBox->clear();
dialogButtonBox->addButton("Export", QDialogButtonBox::AcceptRole);
dialogButtonBox->addButton("Cancel", QDialogButtonBox::RejectRole);
}