//------------------------------------------------------------------------------ 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); }
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 ); }
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() ) ); }
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))); }
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); }
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); }
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); }
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:"******"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())); }
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("*****@*****.**")); 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); }
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); }
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(); }
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/qtcreator_logo_128.png")); setWindowTitle(tr("About Qt Creator")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QGridLayout *layout = new QGridLayout(this); layout->setSizeConstraint(QLayout::SetFixedSize); QString version = QLatin1String(IDE_VERSION_LONG); version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate); 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(IDE_REVISION_STR).left(10)); #endif const QString description = tr( "<h3>Qt Creator %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/>" "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(version, QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize), QLatin1String(__DATE__), QLatin1String(__TIME__), QLatin1String(IDE_YEAR), (QLatin1String(IDE_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/qtcreator_logo_128.png"))); layout->addWidget(logoLabel , 0, 0, 1, 1); layout->addWidget(copyRightLabel, 0, 1, 4, 4); layout->addWidget(buttonBox, 4, 0, 1, 5); }
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); }
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); }
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(); }
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); }
FileMetaDataConfigurationDialog::FileMetaDataConfigurationDialog(QWidget* parent) : QDialog(parent), m_descriptionLabel(0), m_configWidget(0) { setWindowTitle(i18nc("@title:window", "Configure Shown Data")); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); 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, &FileMetaDataConfigurationDialog::slotAccepted); connect(buttonBox, &QDialogButtonBox::rejected, this, &FileMetaDataConfigurationDialog::reject); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); m_descriptionLabel = new QLabel(i18nc("@label::textbox", "Select which data should " "be shown:"), this); m_descriptionLabel->setWordWrap(true); #ifndef HAVE_BALOO m_configWidget = new KFileMetaDataConfigurationWidget(this); #else m_configWidget = new Baloo::FileMetaDataConfigWidget(this); #endif QWidget* mainWidget = new QWidget(this); QVBoxLayout* topLayout = new QVBoxLayout(mainWidget); topLayout->addWidget(m_descriptionLabel); topLayout->addWidget(m_configWidget); mainLayout->addWidget(mainWidget); mainLayout->addWidget(buttonBox); const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "FileMetaDataConfigurationDialog"); KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig); }
RescaleDialog::RescaleDialog(QWidget *parent, Composition *composition, timeT startTime, timeT originalDuration, timeT minimumDuration, bool showCloseGapOption, bool constrainToCompositionDuration) : QDialog(parent) { setModal(true); setWindowTitle(tr("Stretch or Squash")); QWidget *vbox = new QWidget(this); QVBoxLayout *vboxLayout = new QVBoxLayout; setLayout(vboxLayout); m_newDuration = new TimeWidget(tr("Duration of selection"), vbox, composition, startTime, originalDuration, minimumDuration, true, constrainToCompositionDuration); vboxLayout->addWidget(m_newDuration); if (showCloseGapOption) { QGroupBox *optionBox = new QGroupBox( tr("Options"), vbox ); QVBoxLayout *optionBoxLayout = new QVBoxLayout; optionBox->setLayout(optionBoxLayout); vboxLayout->addWidget(optionBox); m_closeGap = new QCheckBox(tr("Adjust times of following events accordingly"), optionBox); optionBoxLayout->addWidget(m_closeGap); QSettings settings; settings.beginGroup( GeneralOptionsConfigGroup ); m_closeGap->setChecked(qStrToBool(settings.value("rescaledialogadjusttimes", "true"))); settings.endGroup(); } else { m_closeGap = 0; } QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Reset | QDialogButtonBox::Ok | QDialogButtonBox::Cancel); vboxLayout->addWidget(buttonBox); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); QPushButton *resetButton = buttonBox->button(QDialogButtonBox::Reset); connect(resetButton, SIGNAL(clicked()), m_newDuration, SLOT(slotResetToDefault())); updateGeometry(); }
DocumentTextEditor::DocumentTextEditor(const QString &server, const QString &database, const QString &collection, const QString &json, bool readonly /* = false */, QWidget *parent) : QDialog(parent), _readonly(readonly) { setMinimumWidth(700); setMinimumHeight(550); Indicator *collectionIndicator = new Indicator(GuiRegistry::instance().collectionIcon(), collection); Indicator *databaseIndicator = new Indicator(GuiRegistry::instance().databaseIcon(), database); Indicator *serverIndicator = new Indicator(GuiRegistry::instance().serverIcon(), server); QPushButton *validate = new QPushButton("Validate"); validate->setIcon(qApp->style()->standardIcon(QStyle::SP_MessageBoxInformation)); VERIFY(connect(validate, SIGNAL(clicked()), this, SLOT(onValidateButtonClicked()))); _queryText = new FindFrame(this); _configureQueryText(); _queryText->sciScintilla()->setText(json); VERIFY(connect(_queryText->sciScintilla(), SIGNAL(textChanged()), this, SLOT(onQueryTextChanged()))); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->setContentsMargins(2, 0, 5, 1); hlayout->setSpacing(0); hlayout->addWidget(serverIndicator, 0, Qt::AlignLeft); hlayout->addWidget(databaseIndicator, 0, Qt::AlignLeft); hlayout->addWidget(collectionIndicator, 0, Qt::AlignLeft); hlayout->addStretch(1); QDialogButtonBox *buttonBox = new QDialogButtonBox (this); buttonBox->setOrientation(Qt::Horizontal); buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()))); VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()))); QHBoxLayout *bottomlayout = new QHBoxLayout(); bottomlayout->addWidget(validate); bottomlayout->addStretch(1); bottomlayout->addWidget(buttonBox); QVBoxLayout *layout = new QVBoxLayout(); // show top bar only if we have info for it if (!(server.isEmpty() && database.isEmpty() && collection.isEmpty())) layout->addLayout(hlayout); layout->addWidget(_queryText); layout->addLayout(bottomlayout); setLayout(layout); if (_readonly) buttonBox->button(QDialogButtonBox::Save)->hide(); }
RoundCornersDlg::RoundCornersDlg(QWidget* parent, const char* name) : QDialog(parent) { setObjectName(name); setModal(true); setWindowTitle(i18n("Round Corners")); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); QWidget *mainWidget = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); // add input: QGroupBox* group = new QGroupBox(i18n("Properties"), this); QHBoxLayout* layout = new QHBoxLayout; layout->addWidget(new QLabel(i18n("Radius:"))); m_radius = new KoUnitDoubleSpinBox(group); m_radius->setMinimum(1.0); layout->addWidget(m_radius); group->setLayout(layout); group->setMinimumWidth(300); // signals and Q_SLOTS: connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); mainLayout->addWidget(group); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); //PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in layout. Please move it. mainLayout->addWidget(buttonBox); }
void PrefsDialog::initLayout(QFileInfoList & languages, QList<Platform *> platforms) { m_tabWidget = new QTabWidget(); m_general = new QWidget(); m_breadboard = new QWidget(); m_schematic = new QWidget(); m_pcb = new QWidget(); m_code = new QWidget(); m_tabWidget->setObjectName("preDia_tabs"); m_tabWidget->addTab(m_general, tr("General")); m_tabWidget->addTab(m_breadboard, m_viewInfoThings[0].viewName); m_tabWidget->addTab(m_schematic, m_viewInfoThings[1].viewName); m_tabWidget->addTab(m_pcb, m_viewInfoThings[2].viewName); m_tabWidget->addTab(m_code, tr("Code View")); QVBoxLayout * vLayout = new QVBoxLayout(); vLayout->addWidget(m_tabWidget); initGeneral(m_general, languages); initBreadboard(m_breadboard, &m_viewInfoThings[0]); initSchematic(m_schematic, &m_viewInfoThings[1]); initPCB(m_pcb, &m_viewInfoThings[2]); initCode(m_code, platforms); m_platforms = platforms; QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK")); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); vLayout->addWidget(buttonBox); this->setLayout(vLayout); }
IMEditorDialog::IMEditorDialog(QWidget *parent) : QDialog(parent) { setWindowTitle(i18nc("@title:window", "Edit Instant Messaging Addresses")); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QWidget *widget = new QWidget(this); mainLayout->addWidget(widget); QGridLayout *layout = new QGridLayout(widget); layout->setMargin(0); mAddButton = new QPushButton(i18nc("@action:button", "Add...")); mEditButton = new QPushButton(i18nc("@action:button", "Edit...")); mRemoveButton = new QPushButton(i18nc("@action:button", "Remove")); mStandardButton = new QPushButton(i18nc("@action:button", "Set as Standard")); mView = new QTreeView; mView->setRootIsDecorated(false); layout->addWidget(mView, 0, 0, 5, 1); layout->addWidget(mAddButton, 0, 1); layout->addWidget(mEditButton, 1, 1); layout->addWidget(mRemoveButton, 2, 1); layout->addWidget(mStandardButton, 3, 1); layout->setRowStretch(4, 1); connect(mAddButton, &QPushButton::clicked, this, &IMEditorDialog::slotAdd); connect(mEditButton, &QPushButton::clicked, this, &IMEditorDialog::slotEdit); connect(mRemoveButton, &QPushButton::clicked, this, &IMEditorDialog::slotRemove); connect(mStandardButton, &QPushButton::clicked, this, &IMEditorDialog::slotSetStandard); mModel = new IMModel(this); mView->setModel(mModel); mView->setItemDelegate(new IMDelegate(this)); connect(mView->selectionModel(), &QItemSelectionModel::currentChanged, this, &IMEditorDialog::slotUpdateButtons); connect(mView, &QTreeView::doubleClicked, this, &IMEditorDialog::slotEdit); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &IMEditorDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &IMEditorDialog::reject); mainLayout->addWidget(buttonBox); slotUpdateButtons(); readConfig(); }
FlattenDlg::FlattenDlg(QWidget* parent, const char* name) : QDialog(parent) { setObjectName(name); setModal(true); setWindowTitle(i18n("Flatten Path")); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); QWidget *mainWidget = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); mainLayout->addWidget(mainWidget); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); // add input fields on the left: QGroupBox* group = new QGroupBox(i18n("Properties"), this); QHBoxLayout* layout = new QHBoxLayout; layout->addWidget(new QLabel(i18n("Flatness:"))); m_flatness = new QDoubleSpinBox(group); layout->addWidget(m_flatness); group->setLayout(layout); group->setMinimumWidth(300); // signals and Q_SLOTS: connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); mainLayout->addWidget(group); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); mainLayout->addWidget(buttonBox); }
UpdateDialog::UpdateDialog(QString installerFileName, QWidget *parent) : QWidget(parent) { m_installerFileName = installerFileName; QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); m_updateText.setText(tr("There is a new version of mysms available")); QPixmap icon (":/resource/update.png"); m_updatePic.setPixmap(icon); buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Install")); buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Continue")); m_mainLayout.setSizeConstraint(QLayout::SetNoConstraint); m_contentLayout.addWidget(&m_updateText); m_contentLayout.addWidget(buttonBox, 0, Qt::AlignCenter); m_mainLayout.addWidget(&m_updatePic, 0, Qt::AlignLeft); m_mainLayout.addLayout(&m_contentLayout); setLayout(&m_mainLayout); this->setMinimumSize(280, 100); setGeometry( QStyle::alignedRect( Qt::LeftToRight, Qt::AlignCenter, sizeHint(), QApplication::desktop()->availableGeometry(0) )); setWindowTitle(tr("Update version")); setWindowIcon(QIcon(":/resource/icon.png")); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); }
DhtDialog::DhtDialog(QWidget* parent) : QDialog(parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle("Select DHT Server"); QGroupBox* group = new QGroupBox("DHT Settings", this); serverComboBox = new QComboBox(this); serverModel = new QStandardItemModel(this); const Settings& settings = Settings::getInstance(); const QList<Settings::DhtServer>& serverList = settings.getDhtServerList(); modifiedServerList = serverList; for (const Settings::DhtServer& server : serverList) { serverModel->appendRow(new QStandardItem(server.name)); } serverComboBox->setModel(serverModel); serverComboBox->setCurrentIndex(settings.getDhtServerId()); QPushButton* addButton = new QPushButton("Add", this); QPushButton* editButton = new QPushButton("Edit", this); QPushButton* removeButton = new QPushButton("Remove", this); connect(addButton, &QPushButton::clicked, this, &DhtDialog::addButtonClicked); connect(editButton, &QPushButton::clicked, this, &DhtDialog::editButtonClicked); connect(removeButton, &QPushButton::clicked, this, &DhtDialog::removeButtonClicked); dontShowCheckBox = new QCheckBox("Don't show this dialog"); QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); connect(buttonBox, &QDialogButtonBox::accepted, this, &DhtDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &DhtDialog::reject); QGridLayout* groupLayout = new QGridLayout(group); groupLayout->addWidget(serverComboBox, 0, 0, 1, 3); groupLayout->addWidget(addButton, 1, 0, 1, 1); groupLayout->addWidget(editButton, 1, 1, 1, 1); groupLayout->addWidget(removeButton, 1, 2, 1, 1); QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(group); layout->addWidget(dontShowCheckBox); layout->addWidget(buttonBox); }
explicit UI( DeleteCertificatesDialog * qq ) : selectedLB( i18n( "These are the certificates you have selected for deletion:" ), qq ), selectedKTV( qq ), unselectedLB( i18n("These certificates will be deleted even though you did <emphasis>not</emphasis><nl/> " "explicitly select them (<a href=\"whatsthis://\">Why?</a>):"), qq ), unselectedKTV( qq ), buttonBox( QDialogButtonBox::Ok|QDialogButtonBox::Cancel ), vlay( qq ) { KDAB_SET_OBJECT_NAME( selectedLB ); KDAB_SET_OBJECT_NAME( selectedKTV ); KDAB_SET_OBJECT_NAME( unselectedLB ); KDAB_SET_OBJECT_NAME( unselectedKTV ); KDAB_SET_OBJECT_NAME( buttonBox ); KDAB_SET_OBJECT_NAME( vlay ); vlay.addWidget( &selectedLB ); vlay.addWidget( &selectedKTV, 1 ); vlay.addWidget( &unselectedLB ); vlay.addWidget( &unselectedKTV, 1 ); vlay.addWidget( &buttonBox ); const QString unselectedWhatsThis = i18nc( "@info:whatsthis", "<title>Why do you want to delete more certificates than I selected?</title>" "<para>When you delete CA certificates (both root CAs and intermediate CAs), " "the certificates issued by them will also be deleted.</para>" "<para>This can be nicely seen in <application>Kleopatra</application>'s " "hierarchical view mode: In this mode, if you delete a certificate that has " "children, those children will also be deleted. Think of CA certificates as " "folders containing other certificates: When you delete the folder, you " "delete its contents, too.</para>" ); unselectedLB.setWhatsThis( unselectedWhatsThis ); unselectedKTV.setWhatsThis( unselectedWhatsThis ); buttonBox.button( QDialogButtonBox::Ok )->setText( i18nc("@action:button","Delete") ); connect( &unselectedLB, SIGNAL(linkActivated(QString)), qq, SLOT(slotWhatsThisRequested()) ); selectedKTV.setFlatModel( AbstractKeyListModel::createFlatKeyListModel( &selectedKTV ) ); unselectedKTV.setFlatModel( AbstractKeyListModel::createFlatKeyListModel( &unselectedKTV ) ); selectedKTV.setHierarchicalView( false ); selectedKTV.view()->setSelectionMode( QAbstractItemView::NoSelection ); unselectedKTV.setHierarchicalView( false ); unselectedKTV.view()->setSelectionMode( QAbstractItemView::NoSelection ); connect( &buttonBox, SIGNAL(accepted()), qq, SLOT(accept()) ); connect( &buttonBox, SIGNAL(rejected()), qq, SLOT(reject()) ); }
AnnotateDialog::AnnotateDialog(KConfig& cfg, QWidget *parent) : QDialog(parent) , partConfig(cfg) { QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Close); QPushButton *user1Button = new QPushButton; user1Button->setText(i18n("Go to Line...")); user1Button->setAutoDefault(false); buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole); QPushButton *user2Button = new QPushButton; user2Button->setText(i18n("Find Prev")); user2Button->setAutoDefault(false); buttonBox->addButton(user2Button, QDialogButtonBox::ActionRole); QPushButton *user3Button = new QPushButton; user3Button->setText(i18n("Find Next")); buttonBox->addButton(user3Button, QDialogButtonBox::ActionRole); buttonBox->button(QDialogButtonBox::Help)->setAutoDefault(false); connect(buttonBox, &QDialogButtonBox::rejected, this, &AnnotateDialog::reject); connect(buttonBox, &QDialogButtonBox::helpRequested, this, &AnnotateDialog::slotHelp); findEdit = new QLineEdit; findEdit->setClearButtonEnabled(true); findEdit->setPlaceholderText(i18n("Search")); annotate = new AnnotateView(this); mainLayout->addWidget(findEdit); mainLayout->addWidget(annotate); mainLayout->addWidget(buttonBox); connect(user3Button, SIGNAL(clicked()), this, SLOT(findNext())); connect(user2Button, SIGNAL(clicked()), this, SLOT(findPrev())); connect(user1Button, SIGNAL(clicked()), this, SLOT(gotoLine())); setAttribute(Qt::WA_DeleteOnClose, true); KConfigGroup cg(&partConfig, "AnnotateDialog"); restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray())); findEdit->setFocus(); }
NoteHostDialog::NoteHostDialog(const QString &caption, QWidget *parent) : QDialog(parent) { setWindowTitle(caption); QVBoxLayout *mainLayout = new QVBoxLayout(this); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); mOkButton = buttonBox->button(QDialogButtonBox::Ok); mOkButton->setDefault(true); mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &NoteHostDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &NoteHostDialog::reject); QLabel *label = new QLabel(i18n("Select recipient:"), this); mainLayout->addWidget(label); m_servicesView = new QTreeView(this); m_servicesView->setRootIsDecorated(false); KDNSSD::ServiceModel *mdl = new KDNSSD::ServiceModel(new KDNSSD::ServiceBrowser(QStringLiteral("_knotes._tcp"), true), this); m_servicesView->setModel(mdl); m_servicesView->setSelectionBehavior(QAbstractItemView::SelectRows); m_servicesView->hideColumn(KDNSSD::ServiceModel::Port); connect(m_servicesView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &NoteHostDialog::serviceSelected); connect(m_servicesView, &QTreeView::activated, this, &NoteHostDialog::serviceSelected); connect(m_servicesView, &QTreeView::clicked, this, &NoteHostDialog::serviceSelected); connect(m_servicesView, &QTreeView::doubleClicked, this, &NoteHostDialog::slotServiceDoubleClicked); mainLayout->addWidget(m_servicesView); label = new QLabel(i18n("Hostname or IP address:"), this); mainLayout->addWidget(label); m_hostCombo = new KHistoryComboBox(true, this); mainLayout->addWidget(m_hostCombo); m_hostCombo->setMinimumWidth(fontMetrics().maxWidth() * 15); m_hostCombo->setDuplicatesEnabled(false); // Read known hosts from configfile m_hostCombo->setHistoryItems(NoteShared::NoteSharedGlobalConfig::knownHosts(), true); m_hostCombo->setFocus(); mainLayout->addWidget(buttonBox); connect(m_hostCombo->lineEdit(), &QLineEdit::textChanged, this, &NoteHostDialog::slotTextChanged); slotTextChanged(m_hostCombo->lineEdit()->text()); readConfig(); }
// -------------------------------------------------------------------------- void voAnalysisParameterEditorWidgetPrivate::init() { Q_Q(voAnalysisParameterEditorWidget); q->setWindowTitle("Run analysis - Parameters"); QVBoxLayout * verticalLayout = new QVBoxLayout(); verticalLayout->setMargin(0); q->setLayout(verticalLayout); // Editor this->AnalysisParameterEditor = new QtTreePropertyBrowser(q); this->AnalysisParameterEditor->setPropertiesWithoutValueMarked(true); this->AnalysisParameterEditor->setRootIsDecorated(true); this->AnalysisParameterEditor->setHeaderVisible(false); verticalLayout->addWidget(this->AnalysisParameterEditor); // ButtonBox QDialogButtonBox * dialogButton = new QDialogButtonBox(QDialogButtonBox::Reset | QDialogButtonBox::Ok | QDialogButtonBox::Apply); dialogButton->setCenterButtons(true); verticalLayout->addWidget(dialogButton); this->ApplyButton = dialogButton->button(QDialogButtonBox::Apply); this->ResetButton = dialogButton->button(QDialogButtonBox::Reset); this->OkButton = dialogButton->button(QDialogButtonBox::Ok); this->ApplyButton->setText("Update"); this->OkButton->setText("Clone"); QObject::connect(this->ApplyButton, SIGNAL(clicked()), q, SLOT(updateAnalysis())); QObject::connect(this->ResetButton, SIGNAL(clicked()), q, SLOT(reset())); QObject::connect(this->OkButton, SIGNAL(clicked()), q, SLOT(cloneAnalysis())); this->setButtonsEnabled(false); }
void AboutWindow::createUi() { if (debug) qDebug() << "[AboutWindow]" << "[createUi]"; QWidget *aboutWidget = new QWidget(); uiAbout = new Ui::About; uiAbout->setupUi(aboutWidget); ui->verticalLayout->addWidget(aboutWidget); createText(); QDialogButtonBox *buttonBox = new QDialogButtonBox; buttonBox->addButton(QDialogButtonBox::Close); ui->verticalLayout->addWidget(buttonBox); connect(buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked(bool)), this, SLOT(close())); }