本文整理汇总了C++中QDialogButtonBox::button方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialogButtonBox::button方法的具体用法?C++ QDialogButtonBox::button怎么用?C++ QDialogButtonBox::button使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox::button方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acceptButton
//------------------------------------------------------------------------------
QPushButton* ctkFileDialogPrivate::acceptButton()const
{
Q_Q(const ctkFileDialog);
QDialogButtonBox* buttonBox = q->findChild<QDialogButtonBox*>();
Q_ASSERT(buttonBox);
QDialogButtonBox::StandardButton button =
(q->acceptMode() == QFileDialog::AcceptOpen ? QDialogButtonBox::Open : QDialogButtonBox::Save);
return buttonBox->button(button);
}
示例2: setDialogActive
void SatellitesConfigDialog::setDialogActive( bool active )
{
m_configWidget->tabWidget->clear();
if( active ) {
m_configWidget->tabWidget->addTab( m_configWidget->tabSatellites,
tr( "&Satellites" ) );
m_configWidget->tabWidget->addTab( m_configWidget->tabDataSources,
tr( "&Data Sources" ) );
} else {
m_configWidget->tabWidget->addTab( m_configWidget->tabDisabled,
tr( "&Activate Plugin" ) );
}
QDialogButtonBox *bBox = m_configWidget->buttonBox;
bBox->button( QDialogButtonBox::Ok )->setEnabled( active );
bBox->button( QDialogButtonBox::Reset )->setEnabled( active );
}
示例3: QDialog
NotificationDialog::NotificationDialog( QWidget * parent )
: QDialog( parent )
{
QVBoxLayout * l = new QVBoxLayout( this );
l->addWidget( new NotificationWidget( this ) );
QDialogButtonBox * dbb = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
l->addWidget( dbb );
connect( dbb->button( QDialogButtonBox::Close ), SIGNAL( clicked() ), SLOT( accept() ) );
}
示例4: QDialog
WatchDialog::WatchDialog(ActionType action, QWidget *parent)
: QDialog(parent)
{
setWindowTitle( (action==Add)? i18n("CVS Watch Add") : i18n("CVS Watch Remove") );
setModal(true);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
connect(buttonBox, &QDialogButtonBox::helpRequested, this, &WatchDialog::slotHelp);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QLabel *textlabel = new QLabel
( (action==Add)? i18n("Add watches for the following events:")
: i18n("Remove watches for the following events:"));
mainLayout->addWidget(textlabel);
all_button = new QRadioButton(i18n("&All"));
mainLayout->addWidget(all_button);
all_button->setFocus();
all_button->setChecked(true);
only_button = new QRadioButton(i18n("&Only:"));
mainLayout->addWidget(only_button);
QGridLayout *eventslayout = new QGridLayout();
mainLayout->addLayout(eventslayout);
eventslayout->addItem(new QSpacerItem(20, 0), 0, 0);
eventslayout->setColumnStretch(0, 0);
eventslayout->setColumnStretch(1, 1);
commitbox = new QCheckBox(i18n("&Commits"));
commitbox->setEnabled(false);
eventslayout->addWidget(commitbox, 0, 1);
editbox = new QCheckBox(i18n("&Edits"));
editbox->setEnabled(false);
eventslayout->addWidget(editbox, 1, 1);
uneditbox = new QCheckBox(i18n("&Unedits"));
uneditbox->setEnabled(false);
eventslayout->addWidget(uneditbox, 2, 1);
QButtonGroup* group = new QButtonGroup(this);
group->addButton(all_button);
group->addButton(only_button);
mainLayout->addWidget(buttonBox);
connect(only_button, SIGNAL(toggled(bool)), commitbox, SLOT(setEnabled(bool)));
connect(only_button, SIGNAL(toggled(bool)), editbox, SLOT(setEnabled(bool)));
connect(only_button, SIGNAL(toggled(bool)), uneditbox, SLOT(setEnabled(bool)));
}
示例5: QLabel
AboutDialog::AboutDialog()
{
this->setWindowTitle(tr("About"));
QGridLayout *layout = new QGridLayout;
this->setLayout(layout);
QLabel *icon = new QLabel(this);
icon->setPixmap(QIcon(":/img/icon.svg").pixmap(QSize(128, 128)));
icon->setFixedSize(128, 128);
icon->setScaledContents(true);
layout->addWidget(icon, 0, 0, 2, 1, Qt::AlignTop);
QLabel *text = new QLabel(this);
text->setText(QString("<b>Edah %1</b><br/>").arg(utils->getAppVersion()) +
"<br/>" +
tr("Edah (heb. ʽe·dhahʹ, eng. assembly) - program that handles multimedia during meetings. "
"Edah can be extended by plugins (for example: \"Player\", \"Recorder\", \"Stream\"), "
"supports touchscreen and is fully configurable.<br/>") +
"WWW: <a href=\"http://edah.tk\">edah.tk</a>");
text->setOpenExternalLinks(true);
text->setWordWrap(true);
layout->addWidget(text, 0, 1);
QLabel *text2 = new QLabel(this);
text2->setText("<br/>"
"This software contains:<br/>"
"• <a href=\"http://www.typicons.com/\">Typicons</a> by Stephen Hutchings licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\">CC BY-SA</a><br/>"
"• <a href=\"https://www.openssl.org/\">OpenSSL</a> by The OpenSSL Project licensed under <a href=\"https://raw.githubusercontent.com/openssl/openssl/master/LICENSE\">OpenSSL License</a><br/>"
"• <a href=\"https://github.com/qtproject/qt-solutions/tree/master/qtsingleapplication\">QtSingleApplication</a> by Digia Plc and/or its subsidiary(-ies) licensed under BSD license<br/>"
"• <a href=\"http://www.google.com/fonts/specimen/Open+Sans\">Open Sans</a> by Steve Matteson licensed under <a href=\"http://www.apache.org/licenses/LICENSE-2.0\">Apache License 2.0</a><br/>"
"<br/>");
text2->setOpenExternalLinks(true);
text2->setWordWrap(false);
layout->addWidget(text2, 1, 1);
QLabel *text3 = new QLabel(this);
text3->setText("This application uploads to update server data such as unique device ID, "
"version of your operating system and IP address.<br/><br/>"
"Copyright (C) 2016-2017 Łukasz Matczak <<a href=\"mailto:[email protected]\">[email protected]</a>><br/>"
"This program comes with ABSOLUTELY NO WARRANTY. This is "
"free software, and you are welcome to redistribute it under "
"certain conditions; ");
#ifdef Q_OS_WIN
text3->setText(text3->text() +
"<a href=\"LICENSE.txt\">click here</a> for details.");
#endif
text3->setOpenExternalLinks(true);
text3->setWordWrap(true);
layout->addWidget(text3, 2, 1);
QDialogButtonBox *btns = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeBtn = btns->button(QDialogButtonBox::Close);
closeBtn->setText(tr("Close"));
connect(closeBtn, &QPushButton::clicked, this, &AboutDialog::close);
layout->addWidget(btns, 3, 0, 1, 2);
}
示例6: testAddEntry
void TestGui::testAddEntry()
{
EntryView* entryView = m_dbWidget->findChild<EntryView*>("entryView");
QAction* entryNewAction = m_mainWindow->findChild<QAction*>("actionEntryNew");
QVERIFY(entryNewAction->isEnabled());
QToolBar* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar");
QWidget* entryNewWidget = toolBar->widgetForAction(entryNewAction);
QVERIFY(entryNewWidget->isVisible());
QVERIFY(entryNewWidget->isEnabled());
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::EditMode);
EditEntryWidget* editEntryWidget = m_dbWidget->findChild<EditEntryWidget*>("editEntryWidget");
QLineEdit* titleEdit = editEntryWidget->findChild<QLineEdit*>("titleEdit");
QTest::keyClicks(titleEdit, "test");
QDialogButtonBox* editEntryWidgetButtonBox = editEntryWidget->findChild<QDialogButtonBox*>("buttonBox");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::ViewMode);
QModelIndex item = entryView->model()->index(1, 1);
Entry* entry = entryView->entryFromIndex(item);
QCOMPARE(entry->title(), QString("test"));
QCOMPARE(entry->historyItems().size(), 0);
// wait for modified timer
QTRY_COMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("NewDatabase.kdbx*"));
QAction* entryEditAction = m_mainWindow->findChild<QAction*>("actionEntryEdit");
QVERIFY(entryEditAction->isEnabled());
QWidget* entryEditWidget = toolBar->widgetForAction(entryEditAction);
QVERIFY(entryEditWidget->isVisible());
QVERIFY(entryEditWidget->isEnabled());
QTest::mouseClick(entryEditWidget, Qt::LeftButton);
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::EditMode);
QTest::keyClicks(titleEdit, "something");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
QCOMPARE(entry->title(), QString("testsomething"));
QCOMPARE(entry->historyItems().size(), 1);
}
示例7: testSearch
void TestGui::testSearch()
{
QAction* searchAction = m_mainWindow->findChild<QAction*>("actionSearch");
QVERIFY(searchAction->isEnabled());
QToolBar* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar");
QWidget* searchActionWidget = toolBar->widgetForAction(searchAction);
QVERIFY(searchActionWidget->isVisible());
QVERIFY(searchActionWidget->isEnabled());
QTest::mouseClick(searchActionWidget, Qt::LeftButton);
EntryView* entryView = m_dbWidget->findChild<EntryView*>("entryView");
QLineEdit* searchEdit = m_dbWidget->findChild<QLineEdit*>("searchEdit");
QToolButton* clearSearch = m_dbWidget->findChild<QToolButton*>("clearButton");
QTest::keyClicks(searchEdit, "ZZZ");
QTRY_COMPARE(entryView->model()->rowCount(), 0);
QTest::mouseClick(clearSearch, Qt::LeftButton);
QTest::keyClicks(searchEdit, "some");
QTRY_COMPARE(entryView->model()->rowCount(), 2);
QModelIndex item = entryView->model()->index(0, 1);
QRect itemRect = entryView->visualRect(item);
QTest::mouseClick(entryView->viewport(), Qt::LeftButton, Qt::NoModifier, itemRect.center());
QAction* entryEditAction = m_mainWindow->findChild<QAction*>("actionEntryEdit");
QVERIFY(entryEditAction->isEnabled());
QWidget* entryEditWidget = toolBar->widgetForAction(entryEditAction);
QVERIFY(entryEditWidget->isVisible());
QVERIFY(entryEditWidget->isEnabled());
QTest::mouseClick(entryEditWidget, Qt::LeftButton);
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::EditMode);
EditEntryWidget* editEntryWidget = m_dbWidget->findChild<EditEntryWidget*>("editEntryWidget");
QDialogButtonBox* editEntryWidgetButtonBox = editEntryWidget->findChild<QDialogButtonBox*>("buttonBox");
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::ViewMode);
QModelIndex item2 = entryView->model()->index(1, 0);
QRect itemRect2 = entryView->visualRect(item2);
QTest::mouseClick(entryView->viewport(), Qt::LeftButton, Qt::NoModifier, itemRect2.center());
QAction* entryDeleteAction = m_mainWindow->findChild<QAction*>("actionEntryDelete");
QWidget* entryDeleteWidget = toolBar->widgetForAction(entryDeleteAction);
QVERIFY(entryDeleteWidget->isVisible());
QVERIFY(entryDeleteWidget->isEnabled());
QTest::mouseClick(entryDeleteWidget, Qt::LeftButton);
QWidget* closeSearchButton = m_dbWidget->findChild<QToolButton*>("closeSearchButton");
QTest::mouseClick(closeSearchButton, Qt::LeftButton);
QCOMPARE(entryView->model()->rowCount(), 1);
}
示例8: QDialog
PiwigoEdit::PiwigoEdit(QWidget* const pParent, Piwigo* const pPiwigo, const QString& title)
: QDialog(pParent, Qt::Dialog)
{
mpPiwigo = pPiwigo;
setWindowTitle(title);
QFrame* const page = new QFrame(this);
QGridLayout* const centerLayout = new QGridLayout();
page->setMinimumSize(500, 128);
mpUrlEdit = new QLineEdit(this);
centerLayout->addWidget(mpUrlEdit, 1, 1);
mpUsernameEdit = new QLineEdit(this);
centerLayout->addWidget(mpUsernameEdit, 2, 1);
mpPasswordEdit = new QLineEdit(this);
mpPasswordEdit->setEchoMode(QLineEdit::Password);
centerLayout->addWidget(mpPasswordEdit, 3, 1);
QLabel* const urlLabel = new QLabel(this);
urlLabel->setText(i18nc("piwigo login settings", "URL:"));
centerLayout->addWidget(urlLabel, 1, 0);
QLabel* const usernameLabel = new QLabel(this);
usernameLabel->setText(i18nc("piwigo login settings", "Username:"));
centerLayout->addWidget(usernameLabel, 2, 0);
QLabel* const passwdLabel = new QLabel(this);
passwdLabel->setText(i18nc("piwigo login settings", "Password:"));
centerLayout->addWidget(passwdLabel, 3, 0);
//---------------------------------------------
page->setLayout(centerLayout);
resize(QSize(300, 150).expandedTo(minimumSizeHint()));
// setting initial data
mpUrlEdit->setText(pPiwigo->url());
mpUsernameEdit->setText(pPiwigo->username());
mpPasswordEdit->setText(pPiwigo->password());
//---------------------------------------------
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
QVBoxLayout* dialogLayout = new QVBoxLayout(this);
dialogLayout->addWidget(page);
dialogLayout->addWidget(buttonBox);
connect(this, SIGNAL(accepted()), this, SLOT(slotOk()));
connect(this, SIGNAL(rejected()), this, SLOT(reject()));
}
示例9: QDialog
SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Configure"));
setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
setLayout(mainLayout);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SendLaterConfigureDialog::reject);
mWidget = new SendLaterWidget(this);
mWidget->setObjectName(QStringLiteral("sendlaterwidget"));
connect(mWidget, &SendLaterWidget::sendNow, this, &SendLaterConfigureDialog::sendNow);
mainLayout->addWidget(mWidget);
mainLayout->addWidget(buttonBox);
connect(okButton, &QPushButton::clicked, this, &SendLaterConfigureDialog::slotSave);
readConfig();
KAboutData aboutData = KAboutData(
QStringLiteral("sendlateragent"),
i18n("Send Later Agent"),
QStringLiteral(KDEPIM_VERSION),
i18n("Send emails later agent."),
KAboutLicense::GPL_V2,
i18n("Copyright (C) 2013-2016 Laurent Montel"));
aboutData.addAuthor(i18n("Laurent Montel"),
i18n("Maintainer"), QStringLiteral("[email protected]"));
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
i18nc("EMAIL OF TRANSLATORS", "Your emails"));
KHelpMenu *helpMenu = new KHelpMenu(this, aboutData, true);
//Initialize menu
QMenu *menu = helpMenu->menu();
helpMenu->action(KHelpMenu::menuAboutApp)->setIcon(QIcon::fromTheme(QStringLiteral("kmail")));
buttonBox->button(QDialogButtonBox::Help)->setMenu(menu);
}
示例10: createGui
void SettingsDialog::createGui()
{
// Header label with large font and a bit of spacing (align with group boxes)
QFont headerLabelFont = m_headerLabel->font();
headerLabelFont.setBold(true);
// Paranoia: Should a font be set in pixels...
const int pointSize = headerLabelFont.pointSize();
if (pointSize > 0)
headerLabelFont.setPointSize(pointSize + 2);
m_headerLabel->setFont(headerLabelFont);
QHBoxLayout *headerHLayout = new QHBoxLayout;
const int leftMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
headerHLayout->addWidget(m_headerLabel);
m_stackedLayout->setMargin(0);
m_stackedLayout->addWidget(new QWidget(this)); // no category selected, for example when filtering
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
QDialogButtonBox::Apply |
QDialogButtonBox::Cancel);
connect(buttonBox->button(QDialogButtonBox::Apply), &QAbstractButton::clicked,
this, &SettingsDialog::apply);
connect(buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
QGridLayout *mainGridLayout = new QGridLayout;
mainGridLayout->addWidget(m_filterLineEdit, 0, 0, 1, 1);
mainGridLayout->addLayout(headerHLayout, 0, 1, 1, 1);
mainGridLayout->addWidget(m_categoryList, 1, 0, 1, 1);
mainGridLayout->addLayout(m_stackedLayout, 1, 1, 1, 1);
mainGridLayout->addWidget(buttonBox, 2, 0, 1, 2);
mainGridLayout->setColumnStretch(1, 4);
setLayout(mainGridLayout);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
setMinimumSize(1000, 550);
if (Utils::HostOsInfo::isMacHost())
setMinimumHeight(minimumHeight() * 1.1);
}
示例11: QDialog
KNotesKeyDialog::KNotesKeyDialog(KActionCollection *globals, QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Configure Shortcuts"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &KNotesKeyDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KNotesKeyDialog::reject);
m_keyChooser = new KShortcutsEditor(globals, this);
mainLayout->addWidget(m_keyChooser);
mainLayout->addWidget(buttonBox);
connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, m_keyChooser, &KShortcutsEditor::allDefault);
readConfig();
}
示例12: QDialog
AboutDialog::AboutDialog(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(QLatin1String(Constants::ICON_QTLOGO_128)));
setWindowTitle("About MMMLauncher");
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QString ideRev;
#ifdef IDE_REVISION
//: This gets conditionally inserted as argument %8 into the description string.
ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(Constants::IDE_REVISION_STR).left(10));
#endif
const QString description = tr(
"<h3>MMMLauncher %1</h3>"
"%2<br/>"
"Built on %3 at %4<br />"
"<br/>"
"Crafted by: %5 (%6)<br/>"
"Thanks to: %7 (%8)<br/>"
"<br />"
"Support: <a href='irc://nyanch.at/#mmm'>irc://nyanch.at/#mmm</a><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.<br/>")
.arg(
QApplication::applicationVersion(),
MMMLUtils::buildCompatibilityString(),
QLatin1String(__DATE__), QLatin1String(__TIME__),
QApplication::organizationName(), "<a href='"+ QApplication::organizationDomain() +"'>"+ QApplication::organizationDomain() +"</a>",
"Endres", "For the old MMMLauncher"
);
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()));
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(QPixmap(QLatin1String(":/images/images/about.png")));
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例13: 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(QLatin1String(Constants::ICON_QTLOGO_128)));
setWindowTitle(tr("About Qt Creator"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QString ideRev;
#ifdef IDE_REVISION
//: This gets conditionally inserted as argument %8 into the description string.
ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(Constants::IDE_REVISION_STR).left(14));
#endif
const QString description = tr(
"<h3>%1</h3>"
"%2<br/>"
"<br/>"
"Built on %3 at %4<br />"
"<br/>"
"%5"
"<br/>"
"Copyright 2008-%6 %7. All rights reserved.<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.<br/>")
.arg(ICore::versionString(),
ICore::buildCompatibilityString(),
QLatin1String(__DATE__), QLatin1String(__TIME__),
ideRev,
QLatin1String(Constants::IDE_YEAR),
QLatin1String(Constants::IDE_AUTHOR));
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_CHECK(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(Constants::ICON_QTLOGO_128)));
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例14: QDialog
EncodeDecodeDialog::EncodeDecodeDialog(QWidget* parent)
: QDialog(parent)
{
setWindowIcon(GuiFactory::instance().encodeDecodeIcon());
setWindowTitle(translations::trEncodeDecode);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout* layout = new QVBoxLayout;
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton* closeButton = buttonBox->button(QDialogButtonBox::Close);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
VERIFY(connect(buttonBox, &QDialogButtonBox::rejected, this, &EncodeDecodeDialog::reject));
QToolButton* decode = new QToolButton;
decode->setIcon(GuiFactory::instance().executeIcon());
VERIFY(connect(decode, &QToolButton::clicked, this, &EncodeDecodeDialog::decode));
decoders_ = new QComboBox;
for(int i = 0; i < SIZEOFMASS(common::EDecoderTypes); ++i) {
decoders_->addItem(common::convertFromString<QString>(common::EDecoderTypes[i]));
}
QHBoxLayout* toolBarLayout = new QHBoxLayout;
toolBarLayout->setContentsMargins(0, 0, 0, 0);
toolBarLayout->addWidget(decode);
toolBarLayout->addWidget(decoders_);
encodeButton_ = new QRadioButton;
decodeButton_ = new QRadioButton;
toolBarLayout->addWidget(encodeButton_);
toolBarLayout->addWidget(decodeButton_);
QSplitter* splitter = new QSplitter;
splitter->setOrientation(Qt::Horizontal);
splitter->setHandleWidth(1);
splitter->setContentsMargins(0, 0, 0, 0);
toolBarLayout->addWidget(splitter);
input_ = new FastoEditor;
input_->installEventFilter(this);
output_ = new FastoEditor;
output_->installEventFilter(this);
layout->addWidget(input_);
layout->addLayout(toolBarLayout);
layout->addWidget(output_);
layout->addWidget(buttonBox);
setMinimumSize(QSize(width, height));
setLayout(layout);
retranslateUi();
}
示例15: 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(QLatin1String(":/application/images/about.png")));
setWindowTitle(tr("About %1").arg(Application::Constants::APP_NAME_STR));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
const QString versionString = tr("%1 %2").arg(Application::Constants::APP_NAME_STR,
Application::Constants::APP_VERSION_STR);
const QString buildCompatibilityString = tr("Based on Qt %1 (%2, %3 bit)").arg(QLatin1String(qVersion()),
compilerString(),
QString::number(QSysInfo::WordSize));
const QString ideRev = tr("From revision %1<br/>").arg(Application::Constants::APP_VERSION_PATCH);
const QString description = tr(
"<h3>%1</h3>"
"%2<br/>"
"<br/>"
"Built on %3 at %4<br />"
"<br/>"
"%5"
"<br/>"
"Copyright 2014 %6. All rights reserved.<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.<br/>")
.arg(versionString,
buildCompatibilityString,
QLatin1String(__DATE__), QLatin1String(__TIME__),
ideRev,
QLatin1String(Application::Constants::APP_ORGNAME_STR));
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_CHECK(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(":/application/images/about.png")));
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}