Port examples/widgets/dialogs to new connection syntax.
Change-Id: Ife8a24b43db400909099765b43f016b4be4bd6ef Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
This commit is contained in:
parent
852b1d7b9b
commit
0e72782363
@ -252,8 +252,8 @@ ClassInfoPage::ClassInfoPage(QWidget *parent)
|
|||||||
|
|
||||||
defaultCtorRadioButton->setChecked(true);
|
defaultCtorRadioButton->setChecked(true);
|
||||||
|
|
||||||
connect(defaultCtorRadioButton, SIGNAL(toggled(bool)),
|
connect(defaultCtorRadioButton, &QAbstractButton::toggled,
|
||||||
copyCtorCheckBox, SLOT(setEnabled(bool)));
|
copyCtorCheckBox, &QWidget::setEnabled);
|
||||||
|
|
||||||
//! [11] //! [12]
|
//! [11] //! [12]
|
||||||
registerField("className*", classNameLineEdit);
|
registerField("className*", classNameLineEdit);
|
||||||
@ -311,14 +311,14 @@ CodeStylePage::CodeStylePage(QWidget *parent)
|
|||||||
baseIncludeLineEdit = new QLineEdit;
|
baseIncludeLineEdit = new QLineEdit;
|
||||||
baseIncludeLabel->setBuddy(baseIncludeLineEdit);
|
baseIncludeLabel->setBuddy(baseIncludeLineEdit);
|
||||||
|
|
||||||
connect(protectCheckBox, SIGNAL(toggled(bool)),
|
connect(protectCheckBox, &QAbstractButton::toggled,
|
||||||
macroNameLabel, SLOT(setEnabled(bool)));
|
macroNameLabel, &QWidget::setEnabled);
|
||||||
connect(protectCheckBox, SIGNAL(toggled(bool)),
|
connect(protectCheckBox, &QAbstractButton::toggled,
|
||||||
macroNameLineEdit, SLOT(setEnabled(bool)));
|
macroNameLineEdit, &QWidget::setEnabled);
|
||||||
connect(includeBaseCheckBox, SIGNAL(toggled(bool)),
|
connect(includeBaseCheckBox, &QAbstractButton::toggled,
|
||||||
baseIncludeLabel, SLOT(setEnabled(bool)));
|
baseIncludeLabel, &QWidget::setEnabled);
|
||||||
connect(includeBaseCheckBox, SIGNAL(toggled(bool)),
|
connect(includeBaseCheckBox, &QAbstractButton::toggled,
|
||||||
baseIncludeLineEdit, SLOT(setEnabled(bool)));
|
baseIncludeLineEdit, &QWidget::setEnabled);
|
||||||
|
|
||||||
registerField("comment", commentCheckBox);
|
registerField("comment", commentCheckBox);
|
||||||
registerField("protect", protectCheckBox);
|
registerField("protect", protectCheckBox);
|
||||||
|
@ -62,7 +62,7 @@ ConfigDialog::ConfigDialog()
|
|||||||
createIcons();
|
createIcons();
|
||||||
contentsWidget->setCurrentRow(0);
|
contentsWidget->setCurrentRow(0);
|
||||||
|
|
||||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close);
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout;
|
QHBoxLayout *horizontalLayout = new QHBoxLayout;
|
||||||
horizontalLayout->addWidget(contentsWidget);
|
horizontalLayout->addWidget(contentsWidget);
|
||||||
@ -102,9 +102,7 @@ void ConfigDialog::createIcons()
|
|||||||
queryButton->setTextAlignment(Qt::AlignHCenter);
|
queryButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
connect(contentsWidget,
|
connect(contentsWidget, &QListWidget::currentItemChanged, this, &ConfigDialog::changePage);
|
||||||
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
|
||||||
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
|
@ -78,7 +78,7 @@ FindDialog::FindDialog(QWidget *parent)
|
|||||||
buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
|
buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
|
||||||
buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
|
buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
|
||||||
|
|
||||||
connect(moreButton, SIGNAL(toggled(bool)), extension, SLOT(setVisible(bool)));
|
connect(moreButton, &QAbstractButton::toggled, extension, &QWidget::setVisible);
|
||||||
|
|
||||||
QVBoxLayout *extensionLayout = new QVBoxLayout;
|
QVBoxLayout *extensionLayout = new QVBoxLayout;
|
||||||
extensionLayout->setMargin(0);
|
extensionLayout->setMargin(0);
|
||||||
|
@ -46,8 +46,10 @@
|
|||||||
Window::Window(QWidget *parent)
|
Window::Window(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
browseButton = createButton(tr("&Browse..."), SLOT(browse()));
|
browseButton = new QPushButton(tr("&Browse..."), this);
|
||||||
findButton = createButton(tr("&Find"), SLOT(find()));
|
connect(browseButton, &QAbstractButton::clicked, this, &Window::browse);
|
||||||
|
findButton = new QPushButton(tr("&Find"), this);
|
||||||
|
connect(findButton, &QAbstractButton::clicked, this, &Window::find);
|
||||||
|
|
||||||
fileComboBox = createComboBox(tr("*"));
|
fileComboBox = createComboBox(tr("*"));
|
||||||
textComboBox = createComboBox();
|
textComboBox = createComboBox();
|
||||||
@ -195,15 +197,6 @@ void Window::showFiles(const QStringList &files)
|
|||||||
}
|
}
|
||||||
//! [8]
|
//! [8]
|
||||||
|
|
||||||
//! [9]
|
|
||||||
QPushButton *Window::createButton(const QString &text, const char *member)
|
|
||||||
{
|
|
||||||
QPushButton *button = new QPushButton(text);
|
|
||||||
connect(button, SIGNAL(clicked()), this, member);
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
//! [9]
|
|
||||||
|
|
||||||
//! [10]
|
//! [10]
|
||||||
QComboBox *Window::createComboBox(const QString &text)
|
QComboBox *Window::createComboBox(const QString &text)
|
||||||
{
|
{
|
||||||
@ -228,8 +221,8 @@ void Window::createFilesTable()
|
|||||||
filesTable->verticalHeader()->hide();
|
filesTable->verticalHeader()->hide();
|
||||||
filesTable->setShowGrid(false);
|
filesTable->setShowGrid(false);
|
||||||
|
|
||||||
connect(filesTable, SIGNAL(cellActivated(int,int)),
|
connect(filesTable, &QTableWidget::cellActivated,
|
||||||
this, SLOT(openFileOfItem(int,int)));
|
this, &Window::openFileOfItem);
|
||||||
}
|
}
|
||||||
//! [11]
|
//! [11]
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QStringList findFiles(const QStringList &files, const QString &text);
|
QStringList findFiles(const QStringList &files, const QString &text);
|
||||||
void showFiles(const QStringList &files);
|
void showFiles(const QStringList &files);
|
||||||
QPushButton *createButton(const QString &text, const char *member);
|
|
||||||
QComboBox *createComboBox(const QString &text = QString());
|
QComboBox *createComboBox(const QString &text = QString());
|
||||||
void createFilesTable();
|
void createFilesTable();
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ LicenseWizard::LicenseWizard(QWidget *parent)
|
|||||||
setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo.png"));
|
setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo.png"));
|
||||||
|
|
||||||
//! [7]
|
//! [7]
|
||||||
connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
|
connect(this, &QWizard::helpRequested, this, &LicenseWizard::showHelp);
|
||||||
//! [7]
|
//! [7]
|
||||||
|
|
||||||
setWindowTitle(tr("License Wizard"));
|
setWindowTitle(tr("License Wizard"));
|
||||||
@ -339,13 +339,13 @@ void ConclusionPage::setVisible(bool visible)
|
|||||||
//! [29]
|
//! [29]
|
||||||
wizard()->setButtonText(QWizard::CustomButton1, tr("&Print"));
|
wizard()->setButtonText(QWizard::CustomButton1, tr("&Print"));
|
||||||
wizard()->setOption(QWizard::HaveCustomButton1, true);
|
wizard()->setOption(QWizard::HaveCustomButton1, true);
|
||||||
connect(wizard(), SIGNAL(customButtonClicked(int)),
|
connect(wizard(), &QWizard::customButtonClicked,
|
||||||
this, SLOT(printButtonClicked()));
|
this, &ConclusionPage::printButtonClicked);
|
||||||
//! [29]
|
//! [29]
|
||||||
} else {
|
} else {
|
||||||
wizard()->setOption(QWizard::HaveCustomButton1, false);
|
wizard()->setOption(QWizard::HaveCustomButton1, false);
|
||||||
disconnect(wizard(), SIGNAL(customButtonClicked(int)),
|
disconnect(wizard(), &QWizard::customButtonClicked,
|
||||||
this, SLOT(printButtonClicked()));
|
this, &ConclusionPage::printButtonClicked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! [28]
|
//! [28]
|
||||||
|
@ -89,10 +89,9 @@ Dialog::Dialog()
|
|||||||
//! [Dialog constructor part4]
|
//! [Dialog constructor part4]
|
||||||
|
|
||||||
//! [Dialog constructor part5]
|
//! [Dialog constructor part5]
|
||||||
connect(button, SIGNAL(clicked()),
|
connect(button, &QAbstractButton::clicked, qApp, &QApplication::closeAllWindows);
|
||||||
qApp, SLOT(closeAllWindows()));
|
connect(QApplication::desktop(), &QDesktopWidget::workAreaResized,
|
||||||
connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
|
this, &Dialog::desktopResized);
|
||||||
this, SLOT(desktopResized(int)));
|
|
||||||
}
|
}
|
||||||
//! [Dialog constructor part5]
|
//! [Dialog constructor part5]
|
||||||
|
|
||||||
|
@ -180,27 +180,27 @@ Dialog::Dialog(QWidget *parent)
|
|||||||
QPushButton *errorButton =
|
QPushButton *errorButton =
|
||||||
new QPushButton(tr("QErrorMessage::showM&essage()"));
|
new QPushButton(tr("QErrorMessage::showM&essage()"));
|
||||||
|
|
||||||
connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
|
connect(integerButton, &QAbstractButton::clicked, this, &Dialog::setInteger);
|
||||||
connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
|
connect(doubleButton, &QAbstractButton::clicked, this, &Dialog::setDouble);
|
||||||
connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
|
connect(itemButton, &QAbstractButton::clicked, this, &Dialog::setItem);
|
||||||
connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
|
connect(textButton, &QAbstractButton::clicked, this, &Dialog::setText);
|
||||||
connect(multiLineTextButton, SIGNAL(clicked()), this, SLOT(setMultiLineText()));
|
connect(multiLineTextButton, &QAbstractButton::clicked, this, &Dialog::setMultiLineText);
|
||||||
connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
connect(colorButton, &QAbstractButton::clicked, this, &Dialog::setColor);
|
||||||
connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
connect(fontButton, &QAbstractButton::clicked, this, &Dialog::setFont);
|
||||||
connect(directoryButton, SIGNAL(clicked()),
|
connect(directoryButton, &QAbstractButton::clicked,
|
||||||
this, SLOT(setExistingDirectory()));
|
this, &Dialog::setExistingDirectory);
|
||||||
connect(openFileNameButton, SIGNAL(clicked()),
|
connect(openFileNameButton, &QAbstractButton::clicked,
|
||||||
this, SLOT(setOpenFileName()));
|
this, &Dialog::setOpenFileName);
|
||||||
connect(openFileNamesButton, SIGNAL(clicked()),
|
connect(openFileNamesButton, &QAbstractButton::clicked,
|
||||||
this, SLOT(setOpenFileNames()));
|
this, &Dialog::setOpenFileNames);
|
||||||
connect(saveFileNameButton, SIGNAL(clicked()),
|
connect(saveFileNameButton, &QAbstractButton::clicked,
|
||||||
this, SLOT(setSaveFileName()));
|
this, &Dialog::setSaveFileName);
|
||||||
connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
|
connect(criticalButton, &QAbstractButton::clicked, this, &Dialog::criticalMessage);
|
||||||
connect(informationButton, SIGNAL(clicked()),
|
connect(informationButton, &QAbstractButton::clicked,
|
||||||
this, SLOT(informationMessage()));
|
this, &Dialog::informationMessage);
|
||||||
connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
|
connect(questionButton, &QAbstractButton::clicked, this, &Dialog::questionMessage);
|
||||||
connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
|
connect(warningButton, &QAbstractButton::clicked, this, &Dialog::warningMessage);
|
||||||
connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));
|
connect(errorButton, &QAbstractButton::clicked, this, &Dialog::errorMessage);
|
||||||
|
|
||||||
QWidget *page = new QWidget;
|
QWidget *page = new QWidget;
|
||||||
QGridLayout *layout = new QGridLayout(page);
|
QGridLayout *layout = new QGridLayout(page);
|
||||||
|
@ -59,8 +59,8 @@ TabDialog::TabDialog(const QString &fileName, QWidget *parent)
|
|||||||
//! [1] //! [3]
|
//! [1] //! [3]
|
||||||
| QDialogButtonBox::Cancel);
|
| QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
//! [2] //! [3]
|
//! [2] //! [3]
|
||||||
|
|
||||||
//! [4]
|
//! [4]
|
||||||
|
@ -200,13 +200,6 @@
|
|||||||
|
|
||||||
We also update the total number of files found.
|
We also update the total number of files found.
|
||||||
|
|
||||||
\snippet dialogs/findfiles/window.cpp 9
|
|
||||||
|
|
||||||
The private \c createButton() function is called from the
|
|
||||||
constructor. We create a QPushButton with the provided text,
|
|
||||||
connect it to the provided slot, and return a pointer to the
|
|
||||||
button.
|
|
||||||
|
|
||||||
\snippet dialogs/findfiles/window.cpp 10
|
\snippet dialogs/findfiles/window.cpp 10
|
||||||
|
|
||||||
The private \c createComboBox() function is also called from the
|
The private \c createComboBox() function is also called from the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user