diff options
120 files changed, 909 insertions, 726 deletions
diff --git a/.qmake.conf b/.qmake.conf index fd7c2fa9..a9b6a329 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs -MODULE_VERSION = 5.5.1 +MODULE_VERSION = 5.6.0 diff --git a/src/assistant/help/qhelpgenerator.cpp b/src/assistant/help/qhelpgenerator.cpp index dfb3780b..7031faaa 100644 --- a/src/assistant/help/qhelpgenerator.cpp +++ b/src/assistant/help/qhelpgenerator.cpp @@ -474,7 +474,7 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa if (filterSetId < 0) return false; ++filterSetId; - foreach (const int &attId, filterAtts) { + foreach (int attId, filterAtts) { d->query->prepare(QLatin1String("INSERT INTO FileAttributeSetTable " "VALUES(?, ?)")); d->query->bindValue(0, filterSetId); @@ -541,7 +541,7 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa fileId = fileMapIt.value(); QSet<int> &fileFilterSet = d->fileFilterMap[fileId]; QSet<int> &tmpFileFilterSet = tmpFileFilterMap[fileId]; - foreach (const int &filter, filterAtts) { + foreach (int filter, filterAtts) { if (!fileFilterSet.contains(filter) && !tmpFileFilterSet.contains(filter)) { fileFilterSet.insert(filter); diff --git a/src/assistant/qhelpgenerator/main.cpp b/src/assistant/qhelpgenerator/main.cpp index 1c7b1295..62c584e5 100644 --- a/src/assistant/qhelpgenerator/main.cpp +++ b/src/assistant/qhelpgenerator/main.cpp @@ -58,6 +58,7 @@ int main(int argc, char *argv[]) bool showHelp = false; bool showVersion = false; bool checkLinks = false; + bool silent = false; // don't require a window manager even though we're a QGuiApplication qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("minimal")); @@ -93,6 +94,8 @@ int main(int argc, char *argv[]) showHelp = true; } else if (arg == QLatin1String("-c")) { checkLinks = true; + } else if (arg == QLatin1String("-s")) { + silent = true; } else { QFileInfo fi(arg); projectFile = fi.absoluteFilePath(); @@ -117,6 +120,7 @@ int main(int argc, char *argv[]) " a default name will be used.\n" " -c Checks whether all links in HTML files\n" " point to files in this help project.\n" + " -s Suppresses status messages.\n" " -v Displays the version of \n" " qhelpgenerator.\n\n"); @@ -158,7 +162,7 @@ int main(int argc, char *argv[]) return -1; } - HelpGenerator generator; + HelpGenerator generator(silent); bool success = true; if (checkLinks) success = generator.checkLinks(*helpData); diff --git a/src/assistant/shared/helpgenerator.cpp b/src/assistant/shared/helpgenerator.cpp index a7a44dcf..2133c661 100644 --- a/src/assistant/shared/helpgenerator.cpp +++ b/src/assistant/shared/helpgenerator.cpp @@ -38,11 +38,13 @@ QT_BEGIN_NAMESPACE -HelpGenerator::HelpGenerator() +HelpGenerator::HelpGenerator(bool silent) { generator = new QHelpGenerator(this); - connect(generator, SIGNAL(statusChanged(QString)), - this, SLOT(printStatus(QString))); + if (!silent) { + connect(generator, SIGNAL(statusChanged(QString)), + this, SLOT(printStatus(QString))); + } connect(generator, SIGNAL(warning(QString)), this, SLOT(printWarning(QString))); } diff --git a/src/assistant/shared/helpgenerator.h b/src/assistant/shared/helpgenerator.h index 20ea4829..19c21e51 100644 --- a/src/assistant/shared/helpgenerator.h +++ b/src/assistant/shared/helpgenerator.h @@ -46,7 +46,7 @@ class HelpGenerator : public QObject Q_OBJECT public: - HelpGenerator(); + HelpGenerator(bool silent = false); bool generate(QHelpDataInterface *helpData, const QString &outputFileName); bool checkLinks(const QHelpDataInterface &helpData); diff --git a/src/designer/src/components/buddyeditor/buddyeditor.cpp b/src/designer/src/components/buddyeditor/buddyeditor.cpp index 711cf6df..682e9f5e 100644 --- a/src/designer/src/components/buddyeditor/buddyeditor.cpp +++ b/src/designer/src/components/buddyeditor/buddyeditor.cpp @@ -428,7 +428,7 @@ QWidget *BuddyEditor::findBuddy(QLabel *l, const QWidgetList &existingBuddies) c void BuddyEditor::createContextMenu(QMenu &menu) { QAction *autoAction = menu.addAction(tr("Set automatically")); - connect(autoAction, SIGNAL(triggered()), this, SLOT(autoBuddy())); + connect(autoAction, &QAction::triggered, this, &BuddyEditor::autoBuddy); menu.addSeparator(); ConnectionEdit::createContextMenu(menu); } diff --git a/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp b/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp index 84ec23b0..7b1eb0b8 100644 --- a/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp +++ b/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp @@ -73,14 +73,14 @@ void BuddyEditorPlugin::initialize(QDesignerFormEditorInterface *core) m_core = core; m_initialized = true; - connect(core->formWindowManager(), SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)), - this, SLOT(addFormWindow(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowAdded, + this, &BuddyEditorPlugin::addFormWindow); - connect(core->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)), - this, SLOT(removeFormWindow(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowRemoved, + this, &BuddyEditorPlugin::removeFormWindow); - connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), - this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + this, &BuddyEditorPlugin::activeFormWindowChanged); } QDesignerFormEditorInterface *BuddyEditorPlugin::core() const @@ -95,7 +95,7 @@ void BuddyEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWindow) BuddyEditorTool *tool = new BuddyEditorTool(formWindow, this); m_tools[formWindow] = tool; - connect(m_action, SIGNAL(triggered()), tool->action(), SLOT(trigger())); + connect(m_action, &QAction::triggered, tool->action(), &QAction::trigger); formWindow->registerTool(tool); } @@ -106,7 +106,7 @@ void BuddyEditorPlugin::removeFormWindow(QDesignerFormWindowInterface *formWindo BuddyEditorTool *tool = m_tools.value(formWindow); m_tools.remove(formWindow); - disconnect(m_action, SIGNAL(triggered()), tool->action(), SLOT(trigger())); + disconnect(m_action, &QAction::triggered, tool->action(), &QAction::trigger); // ### FIXME disable the tool delete tool; diff --git a/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp b/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp index c71f3bfa..c0fb20e3 100644 --- a/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp +++ b/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp @@ -77,9 +77,10 @@ QWidget *BuddyEditorTool::editor() const if (!m_editor) { Q_ASSERT(formWindow() != 0); m_editor = new BuddyEditor(formWindow(), 0); - connect(formWindow(), SIGNAL(mainContainerChanged(QWidget*)), m_editor, SLOT(setBackground(QWidget*))); - connect(formWindow(), SIGNAL(changed()), - m_editor, SLOT(updateBackground())); + connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged, + m_editor.data(), &BuddyEditor::setBackground); + connect(formWindow(), &QDesignerFormWindowInterface::changed, + m_editor.data(), &BuddyEditor::updateBackground); } return m_editor; diff --git a/src/designer/src/components/formeditor/deviceprofiledialog.cpp b/src/designer/src/components/formeditor/deviceprofiledialog.cpp index 4cd39d63..fca2d9eb 100644 --- a/src/designer/src/components/formeditor/deviceprofiledialog.cpp +++ b/src/designer/src/components/formeditor/deviceprofiledialog.cpp @@ -88,12 +88,15 @@ DeviceProfileDialog::DeviceProfileDialog(QDesignerDialogGuiInterface *dlgGui, QW for (QStringList::const_iterator it = styles.constBegin(); it != cend; ++it) m_ui->m_styleCombo->addItem(*it, *it); - connect(m_ui->m_nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(nameChanged(QString))); - connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - connect(m_ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept())); + connect(m_ui->m_nameLineEdit, &QLineEdit::textChanged, this, &DeviceProfileDialog::nameChanged); + connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + connect(m_ui->buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, + this, &QDialog::accept); // Note that Load/Save emit accepted() of the button box.. - connect(m_ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(save())); - connect(m_ui->buttonBox->button(QDialogButtonBox::Open), SIGNAL(clicked()), this, SLOT(open())); + connect(m_ui->buttonBox->button(QDialogButtonBox::Save), &QAbstractButton::clicked, + this, &DeviceProfileDialog::save); + connect(m_ui->buttonBox->button(QDialogButtonBox::Open), &QAbstractButton::clicked, + this, &DeviceProfileDialog::open); } DeviceProfileDialog::~DeviceProfileDialog() diff --git a/src/designer/src/components/formeditor/dpi_chooser.cpp b/src/designer/src/components/formeditor/dpi_chooser.cpp index c1639095..f553d429 100644 --- a/src/designer/src/components/formeditor/dpi_chooser.cpp +++ b/src/designer/src/components/formeditor/dpi_chooser.cpp @@ -84,6 +84,8 @@ DPI_Chooser::DPI_Chooser(QWidget *parent) : m_dpiXSpinBox(new QSpinBox), m_dpiYSpinBox(new QSpinBox) { + typedef void (QComboBox::*QComboIntSignal)(int); + // Predefined settings: System DeviceProfile::systemResolution(&(m_systemEntry->dpiX), &(m_systemEntry->dpiY)); m_systemEntry->description = 0; @@ -101,7 +103,8 @@ DPI_Chooser::DPI_Chooser(QWidget *parent) : setFocusProxy(m_predefinedCombo); m_predefinedCombo->setEditable(false); m_predefinedCombo->setCurrentIndex(0); - connect(m_predefinedCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(syncSpinBoxes())); + connect(m_predefinedCombo, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged), + this, &DPI_Chooser::syncSpinBoxes); // top row with predefined settings QVBoxLayout *vBoxLayout = new QVBoxLayout; vBoxLayout->setMargin(0); diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.cpp b/src/designer/src/components/formeditor/embeddedoptionspage.cpp index 8c84295e..4591f08a 100644 --- a/src/designer/src/components/formeditor/embeddedoptionspage.cpp +++ b/src/designer/src/components/formeditor/embeddedoptionspage.cpp @@ -145,6 +145,8 @@ EmbeddedOptionsControlPrivate::EmbeddedOptionsControlPrivate(QDesignerFormEditor void EmbeddedOptionsControlPrivate::init(EmbeddedOptionsControl *q) { + typedef void (QComboBox::*QComboIntSignal)(int); + m_q = q; QVBoxLayout *vLayout = new QVBoxLayout; QHBoxLayout *hLayout = new QHBoxLayout; @@ -152,21 +154,25 @@ void EmbeddedOptionsControlPrivate::init(EmbeddedOptionsControl *q) m_profileCombo->setEditable(false); hLayout->addWidget(m_profileCombo); m_profileCombo->addItem(EmbeddedOptionsControl::tr("None")); - EmbeddedOptionsControl::connect(m_profileCombo, SIGNAL(currentIndexChanged(int)), m_q, SLOT(slotProfileIndexChanged(int))); + EmbeddedOptionsControl::connect(m_profileCombo, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged), + m_q, &EmbeddedOptionsControl::slotProfileIndexChanged); m_addButton->setIcon(createIconSet(QString::fromUtf8("plus.png"))); m_addButton->setToolTip(EmbeddedOptionsControl::tr("Add a profile")); - EmbeddedOptionsControl::connect(m_addButton, SIGNAL(clicked()), m_q, SLOT(slotAdd())); + EmbeddedOptionsControl::connect(m_addButton, &QAbstractButton::clicked, + m_q, &EmbeddedOptionsControl::slotAdd); hLayout->addWidget(m_addButton); - EmbeddedOptionsControl::connect(m_editButton, SIGNAL(clicked()), m_q, SLOT(slotEdit())); + EmbeddedOptionsControl::connect(m_editButton, &QAbstractButton::clicked, + m_q, &EmbeddedOptionsControl::slotEdit); m_editButton->setIcon(createIconSet(QString::fromUtf8("edit.png"))); m_editButton->setToolTip(EmbeddedOptionsControl::tr("Edit the selected profile")); hLayout->addWidget(m_editButton); m_deleteButton->setIcon(createIconSet(QString::fromUtf8("minus.png"))); m_deleteButton->setToolTip(EmbeddedOptionsControl::tr("Delete the selected profile")); - EmbeddedOptionsControl::connect(m_deleteButton, SIGNAL(clicked()), m_q, SLOT(slotDelete())); + EmbeddedOptionsControl::connect(m_deleteButton, &QAbstractButton::clicked, + m_q, &EmbeddedOptionsControl::slotDelete); hLayout->addWidget(m_deleteButton); hLayout->addStretch(); diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.h b/src/designer/src/components/formeditor/embeddedoptionspage.h index 1dc0a33e..003fc49a 100644 --- a/src/designer/src/components/formeditor/embeddedoptionspage.h +++ b/src/designer/src/components/formeditor/embeddedoptionspage.h @@ -68,6 +68,8 @@ private slots: void slotProfileIndexChanged(int); private: + friend class EmbeddedOptionsControlPrivate; + EmbeddedOptionsControlPrivate *m_d; }; diff --git a/src/designer/src/components/formeditor/formeditor.cpp b/src/designer/src/components/formeditor/formeditor.cpp index 5a0b2482..898e4af7 100644 --- a/src/designer/src/components/formeditor/formeditor.cpp +++ b/src/designer/src/components/formeditor/formeditor.cpp @@ -90,8 +90,10 @@ FormEditor::FormEditor(QObject *parent) FormWindowManager *formWindowManager = new FormWindowManager(this, this); setFormManager(formWindowManager); - connect(formWindowManager, SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)), widgetFactory, SLOT(formWindowAdded(QDesignerFormWindowInterface*))); - connect(formWindowManager, SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), widgetFactory, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*))); + connect(formWindowManager, &QDesignerFormWindowManagerInterface::formWindowAdded, + widgetFactory, &WidgetFactory::formWindowAdded); + connect(formWindowManager, &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + widgetFactory, &WidgetFactory::activeFormWindowChanged); QExtensionManager *mgr = new QExtensionManager(this); const QString containerExtensionId = Q_TYPEID(QDesignerContainerExtension); @@ -140,8 +142,8 @@ FormEditor::FormEditor(QObject *parent) QtResourceModel *resourceModel = new QtResourceModel(this); setResourceModel(resourceModel); - connect(resourceModel, SIGNAL(qrcFileModifiedExternally(QString)), - this, SLOT(slotQrcFileChangedExternally(QString))); + connect(resourceModel, &QtResourceModel::qrcFileModifiedExternally, + this, &FormEditor::slotQrcFileChangedExternally); QList<QDesignerOptionsPageInterface*> optionsPages; optionsPages << new TemplateOptionsPage(this) << new FormEditorOptionsPage(this) << new EmbeddedOptionsPage(this); diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp index 8953d715..fdaed87b 100644 --- a/src/designer/src/components/formeditor/formwindow.cpp +++ b/src/designer/src/components/formeditor/formwindow.cpp @@ -403,19 +403,23 @@ void FormWindow::init() m_defaultMargin = INT_MIN; m_defaultSpacing = INT_MIN; - connect(m_widgetStack, SIGNAL(currentToolChanged(int)), this, SIGNAL(toolChanged(int))); + connect(m_widgetStack, &FormWindowWidgetStack::currentToolChanged, + this, &QDesignerFormWindowInterface::toolChanged); m_selectionChangedTimer = new QTimer(this); m_selectionChangedTimer->setSingleShot(true); - connect(m_selectionChangedTimer, SIGNAL(timeout()), this, SLOT(selectionChangedTimerDone())); + connect(m_selectionChangedTimer, &QTimer::timeout, this, + &FormWindow::selectionChangedTimerDone); m_checkSelectionTimer = new QTimer(this); m_checkSelectionTimer->setSingleShot(true); - connect(m_checkSelectionTimer, SIGNAL(timeout()), this, SLOT(checkSelectionNow())); + connect(m_checkSelectionTimer, &QTimer::timeout, + this, &FormWindow::checkSelectionNow); m_geometryChangedTimer = new QTimer(this); m_geometryChangedTimer->setSingleShot(true); - connect(m_geometryChangedTimer, SIGNAL(timeout()), this, SIGNAL(geometryChanged())); + connect(m_geometryChangedTimer, &QTimer::timeout, + this, &QDesignerFormWindowInterface::geometryChanged); m_rubberBand = 0; @@ -424,8 +428,10 @@ void FormWindow::init() m_mainContainer = 0; m_currentWidget = 0; - connect(&m_undoStack, SIGNAL(changed()), this, SIGNAL(changed())); - connect(&m_undoStack, SIGNAL(changed()), this, SLOT(checkSelection())); + connect(&m_undoStack, &QDesignerUndoStack::changed, + this, &QDesignerFormWindowInterface::changed); + connect(&m_undoStack, &QDesignerUndoStack::changed, + this, &FormWindow::checkSelection); core()->metaDataBase()->add(this); @@ -434,7 +440,7 @@ void FormWindow::init() QAction *a = new QAction(this); a->setText(tr("Edit contents")); a->setShortcut(tr("F2")); - connect(a, SIGNAL(triggered()), this, SLOT(editContents())); + connect(a, &QAction::triggered, this, &FormWindow::editContents); addAction(a); } @@ -2252,7 +2258,7 @@ QAction *FormWindow::createSelectAncestorSubMenu(QWidget *w) // Create a submenu listing the managed, unselected parents QMenu *menu = new QMenu; QActionGroup *ag = new QActionGroup(menu); - QObject::connect(ag, SIGNAL(triggered(QAction*)), this, SLOT(slotSelectWidget(QAction*))); + QObject::connect(ag, &QActionGroup::triggered, this, &FormWindow::slotSelectWidget); const int size = parents.size(); for (int i = 0; i < size; i++) { QWidget *w = parents.at(i); diff --git a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp index b8d8afcc..c9341a58 100644 --- a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp +++ b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp @@ -177,7 +177,8 @@ void FormWindowWidgetStack::addTool(QDesignerFormWindowToolInterface *tool) m_tools.append(tool); - connect(tool->action(), SIGNAL(triggered()), this, SLOT(setSenderAsCurrentTool())); + connect(tool->action(), &QAction::triggered, + this, &FormWindowWidgetStack::setSenderAsCurrentTool); } QDesignerFormWindowToolInterface *FormWindowWidgetStack::tool(int index) const diff --git a/src/designer/src/components/formeditor/formwindowcursor.cpp b/src/designer/src/components/formeditor/formwindowcursor.cpp index 1eabeef3..2010d8d4 100644 --- a/src/designer/src/components/formeditor/formwindowcursor.cpp +++ b/src/designer/src/components/formeditor/formwindowcursor.cpp @@ -50,7 +50,7 @@ FormWindowCursor::FormWindowCursor(FormWindow *fw, QObject *parent) m_formWindow(fw) { update(); - connect(fw, SIGNAL(changed()), this, SLOT(update())); + connect(fw, &QDesignerFormWindowInterface::changed, this, &FormWindowCursor::update); } FormWindowCursor::~FormWindowCursor() diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp index d0537d40..386d09f8 100644 --- a/src/designer/src/components/formeditor/formwindowmanager.cpp +++ b/src/designer/src/components/formeditor/formwindowmanager.cpp @@ -258,14 +258,20 @@ void FormWindowManager::addFormWindow(QDesignerFormWindowInterface *w) if (!formWindow || m_formWindows.contains(formWindow)) return; - connect(formWindow, SIGNAL(selectionChanged()), this, SLOT(slotUpdateActions())); - connect(formWindow->commandHistory(), SIGNAL(indexChanged(int)), this, SLOT(slotUpdateActions())); - connect(formWindow, SIGNAL(toolChanged(int)), this, SLOT(slotUpdateActions())); - - if (ActionEditor *ae = qobject_cast<ActionEditor *>(m_core->actionEditor())) - connect(w, SIGNAL(mainContainerChanged(QWidget*)), ae, SLOT(mainContainerChanged())); + connect(formWindow, &QDesignerFormWindowInterface::selectionChanged, + this, &FormWindowManager::slotUpdateActions); + connect(formWindow->commandHistory(), &QUndoStack::indexChanged, + this, &FormWindowManager::slotUpdateActions); + connect(formWindow, &QDesignerFormWindowInterface::toolChanged, + this, &FormWindowManager::slotUpdateActions); + + if (ActionEditor *ae = qobject_cast<ActionEditor *>(m_core->actionEditor())) { + connect(w, &QDesignerFormWindowInterface::mainContainerChanged, + ae, &ActionEditor::mainContainerChanged); + } if (QDesignerObjectInspector *oi = qobject_cast<QDesignerObjectInspector *>(m_core->objectInspector())) - connect(w, SIGNAL(mainContainerChanged(QWidget*)), oi, SLOT(mainContainerChanged())); + connect(w, &QDesignerFormWindowInterface::mainContainerChanged, + oi, &QDesignerObjectInspector::mainContainerChanged); m_formWindows.append(formWindow); emit formWindowAdded(formWindow); @@ -362,7 +368,7 @@ void FormWindowManager::setupActions() m_actionCut->setShortcut(QKeySequence::Cut); m_actionCut->setStatusTip(tr("Cuts the selected widgets and puts them on the clipboard")); m_actionCut->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Cut"))); - connect(m_actionCut, SIGNAL(triggered()), this, SLOT(slotActionCutActivated())); + connect(m_actionCut, &QAction::triggered, this, &FormWindowManager::slotActionCutActivated); m_actionCut->setEnabled(false); m_actionCopy = new QAction(createIconSet(QStringLiteral("editcopy.png")), tr("&Copy"), this); @@ -370,7 +376,7 @@ void FormWindowManager::setupActions() m_actionCopy->setShortcut(QKeySequence::Copy); m_actionCopy->setStatusTip(tr("Copies the selected widgets to the clipboard")); m_actionCopy->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Copy"))); - connect(m_actionCopy, SIGNAL(triggered()), this, SLOT(slotActionCopyActivated())); + connect(m_actionCopy, &QAction::triggered, this, &FormWindowManager::slotActionCopyActivated); m_actionCopy->setEnabled(false); m_actionPaste = new QAction(createIconSet(QStringLiteral("editpaste.png")), tr("&Paste"), this); @@ -378,7 +384,7 @@ void FormWindowManager::setupActions() m_actionPaste->setShortcut(QKeySequence::Paste); m_actionPaste->setStatusTip(tr("Pastes the clipboard's contents")); m_actionPaste->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Paste"))); - connect(m_actionPaste, SIGNAL(triggered()), this, SLOT(slotActionPasteActivated())); + connect(m_actionPaste, &QAction::triggered, this, &FormWindowManager::slotActionPasteActivated); m_actionPaste->setEnabled(false); #endif @@ -386,7 +392,7 @@ void FormWindowManager::setupActions() m_actionDelete->setObjectName(QStringLiteral("__qt_delete_action")); m_actionDelete->setStatusTip(tr("Deletes the selected widgets")); m_actionDelete->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Delete"))); - connect(m_actionDelete, SIGNAL(triggered()), this, SLOT(slotActionDeleteActivated())); + connect(m_actionDelete, &QAction::triggered, this, &FormWindowManager::slotActionDeleteActivated); m_actionDelete->setEnabled(false); m_actionSelectAll = new QAction(tr("Select &All"), this); @@ -394,7 +400,7 @@ void FormWindowManager::setupActions() m_actionSelectAll->setShortcut(QKeySequence::SelectAll); m_actionSelectAll->setStatusTip(tr("Selects all widgets")); m_actionSelectAll->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Select All"))); - connect(m_actionSelectAll, SIGNAL(triggered()), this, SLOT(slotActionSelectAllActivated())); + connect(m_actionSelectAll, &QAction::triggered, this, &FormWindowManager::slotActionSelectAllActivated); m_actionSelectAll->setEnabled(false); m_actionRaise = new QAction(createIconSet(QStringLiteral("editraise.png")), tr("Bring to &Front"), this); @@ -402,7 +408,7 @@ void FormWindowManager::setupActions() m_actionRaise->setShortcut(Qt::CTRL + Qt::Key_L); m_actionRaise->setStatusTip(tr("Raises the selected widgets")); m_actionRaise->setWhatsThis(tr("Raises the selected widgets")); - connect(m_actionRaise, SIGNAL(triggered()), this, SLOT(slotActionRaiseActivated())); + connect(m_actionRaise, &QAction::triggered, this, &FormWindowManager::slotActionRaiseActivated); m_actionRaise->setEnabled(false); m_actionLower = new QAction(createIconSet(QStringLiteral("editlower.png")), tr("Send to &Back"), this); @@ -410,7 +416,7 @@ void FormWindowManager::setupActions() m_actionLower->setShortcut(Qt::CTRL + Qt::Key_K); m_actionLower->setStatusTip(tr("Lowers the selected widgets")); m_actionLower->setWhatsThis(tr("Lowers the selected widgets")); - connect(m_actionLower, SIGNAL(triggered()), this, SLOT(slotActionLowerActivated())); + connect(m_actionLower, &QAction::triggered, this, &FormWindowManager::slotActionLowerActivated); m_actionLower->setEnabled(false); m_actionAdjustSize = new QAction(createIconSet(QStringLiteral("adjustsize.png")), tr("Adjust &Size"), this); @@ -418,7 +424,7 @@ void FormWindowManager::setupActions() m_actionAdjustSize->setShortcut(Qt::CTRL + Qt::Key_J); m_actionAdjustSize->setStatusTip(tr("Adjusts the size of the selected widget")); m_actionAdjustSize->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Adjust Size"))); - connect(m_actionAdjustSize, SIGNAL(triggered()), this, SLOT(slotActionAdjustSizeActivated())); + connect(m_actionAdjustSize, &QAction::triggered, this, &FormWindowManager::slotActionAdjustSizeActivated); m_actionAdjustSize->setEnabled(false); @@ -429,7 +435,7 @@ void FormWindowManager::setupActions() m_actionHorizontalLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Horizontally"))); m_actionHorizontalLayout->setData(LayoutInfo::HBox); m_actionHorizontalLayout->setEnabled(false); - connect(m_actionHorizontalLayout, SIGNAL(triggered()), this, SLOT(createLayout())); + connect(m_actionHorizontalLayout, &QAction::triggered, this, &FormWindowManager::createLayout); m_actionVerticalLayout = new QAction(createIconSet(QStringLiteral("editvlayout.png")), tr("Lay Out &Vertically"), this); m_actionVerticalLayout->setObjectName(QStringLiteral("__qt_vertical_layout_action")); @@ -438,7 +444,7 @@ void FormWindowManager::setupActions() m_actionVerticalLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Vertically"))); m_actionVerticalLayout->setData(LayoutInfo::VBox); m_actionVerticalLayout->setEnabled(false); - connect(m_actionVerticalLayout, SIGNAL(triggered()), this, SLOT(createLayout())); + connect(m_actionVerticalLayout, &QAction::triggered, this, &FormWindowManager::createLayout); QIcon formIcon = QIcon::fromTheme(QStringLiteral("designer-form-layout"), createIconSet(QStringLiteral("editform.png"))); m_actionFormLayout = new QAction(formIcon, tr("Lay Out in a &Form Layout"), this); @@ -448,7 +454,7 @@ void FormWindowManager::setupActions() m_actionFormLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out in a Form"))); m_actionFormLayout->setData(LayoutInfo::Form); m_actionFormLayout->setEnabled(false); - connect(m_actionFormLayout, SIGNAL(triggered()), this, SLOT(createLayout())); + connect(m_actionFormLayout, &QAction::triggered, this, &FormWindowManager::createLayout); m_actionGridLayout = new QAction(createIconSet(QStringLiteral("editgrid.png")), tr("Lay Out in a &Grid"), this); m_actionGridLayout->setObjectName(QStringLiteral("__qt_grid_layout_action")); @@ -457,7 +463,7 @@ void FormWindowManager::setupActions() m_actionGridLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out in a Grid"))); m_actionGridLayout->setData(LayoutInfo::Grid); m_actionGridLayout->setEnabled(false); - connect(m_actionGridLayout, SIGNAL(triggered()), this, SLOT(createLayout())); + connect(m_actionGridLayout, &QAction::triggered, this, &FormWindowManager::createLayout); m_actionSplitHorizontal = new QAction(createIconSet(QStringLiteral("edithlayoutsplit.png")), tr("Lay Out Horizontally in S&plitter"), this); @@ -467,7 +473,7 @@ void FormWindowManager::setupActions() m_actionSplitHorizontal->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Horizontally in Splitter"))); m_actionSplitHorizontal->setData(LayoutInfo::HSplitter); m_actionSplitHorizontal->setEnabled(false); - connect(m_actionSplitHorizontal, SIGNAL(triggered()), this, SLOT(createLayout())); + connect(m_actionSplitHorizontal, &QAction::triggered, this, &FormWindowManager::createLayout); m_actionSplitVertical = new QAction(createIconSet(QStringLiteral("editvlayoutsplit.png")), tr("Lay Out Vertically in Sp&litter"), this); @@ -475,7 +481,7 @@ void FormWindowManager::setupActions() m_actionSplitVertical->setShortcut(Qt::CTRL + Qt::Key_4); m_actionSplitVertical->setStatusTip(tr("Lays out the selected widgets vertically in a splitter")); m_actionSplitVertical->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Vertically in Splitter"))); - connect(m_actionSplitVertical, SIGNAL(triggered()), this, SLOT(createLayout())); + connect(m_actionSplitVertical, &QAction::triggered, this, &FormWindowManager::createLayout); m_actionSplitVertical->setData(LayoutInfo::VSplitter); m_actionSplitVertical->setEnabled(false); @@ -485,22 +491,22 @@ void FormWindowManager::setupActions() m_actionBreakLayout->setShortcut(Qt::CTRL + Qt::Key_0); m_actionBreakLayout->setStatusTip(tr("Breaks the selected layout")); m_actionBreakLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Break Layout"))); - connect(m_actionBreakLayout, SIGNAL(triggered()), this, SLOT(slotActionBreakLayoutActivated())); + connect(m_actionBreakLayout, &QAction::triggered, this, &FormWindowManager::slotActionBreakLayoutActivated); m_actionBreakLayout->setEnabled(false); m_actionSimplifyLayout = new QAction(tr("Si&mplify Grid Layout"), this); m_actionSimplifyLayout->setObjectName(QStringLiteral("__qt_simplify_layout_action")); m_actionSimplifyLayout->setStatusTip(tr("Removes empty columns and rows")); m_actionSimplifyLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Simplify Layout"))); - connect(m_actionSimplifyLayout, SIGNAL(triggered()), this, SLOT(slotActionSimplifyLayoutActivated())); + connect(m_actionSimplifyLayout, &QAction::triggered, this, &FormWindowManager::slotActionSimplifyLayoutActivated); m_actionSimplifyLayout->setEnabled(false); m_actionDefaultPreview = new QAction(tr("&Preview..."), this); m_actionDefaultPreview->setObjectName(QStringLiteral("__qt_default_preview_action")); m_actionDefaultPreview->setStatusTip(tr("Preview current form")); m_actionDefaultPreview->setWhatsThis(whatsThisFrom(QStringLiteral("Form|Preview"))); - connect(m_actionDefaultPreview, SIGNAL(triggered()), - this, SLOT(showPreview())); + connect(m_actionDefaultPreview, &QAction::triggered, + this, &FormWindowManager::showPreview); m_undoGroup = new QUndoGroup(this); @@ -514,7 +520,8 @@ void FormWindowManager::setupActions() m_actionShowFormWindowSettingsDialog = new QAction(tr("Form &Settings..."), this); m_actionShowFormWindowSettingsDialog->setObjectName(QStringLiteral("__qt_form_settings_action")); - connect(m_actionShowFormWindowSettingsDialog, SIGNAL(triggered()), this, SLOT(slotActionShowFormWindowSettingsDialog())); + connect(m_actionShowFormWindowSettingsDialog, &QAction::triggered, + this, &FormWindowManager::slotActionShowFormWindowSettingsDialog); m_actionShowFormWindowSettingsDialog->setEnabled(false); #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) @@ -1066,8 +1073,8 @@ QActionGroup *FormWindowManager::actionGroup(ActionGroup actionGroup) const // Wish we could make the 'this' pointer mutable ;-) QObject *parent = const_cast<FormWindowManager*>(this); m_actionGroupPreviewInStyle = new PreviewActionGroup(m_core, parent); - connect(m_actionGroupPreviewInStyle, SIGNAL(preview(QString,int)), - this, SLOT(slotActionGroupPreviewInStyle(QString,int))); + connect(m_actionGroupPreviewInStyle, &PreviewActionGroup::preview, + this, &FormWindowManager::slotActionGroupPreviewInStyle); } return m_actionGroupPreviewInStyle; } diff --git a/src/designer/src/components/formeditor/previewactiongroup.cpp b/src/designer/src/components/formeditor/previewactiongroup.cpp index 173d059f..b0b7e747 100644 --- a/src/designer/src/components/formeditor/previewactiongroup.cpp +++ b/src/designer/src/components/formeditor/previewactiongroup.cpp @@ -52,7 +52,7 @@ PreviewActionGroup::PreviewActionGroup(QDesignerFormEditorInterface *core, QObje /* Create a list of up to MaxDeviceActions invisible actions to be * populated with device profiles (actiondata: index) followed by the * standard style actions (actiondata: style name). */ - connect(this, SIGNAL(triggered(QAction*)), this, SLOT(slotTriggered(QAction*))); + connect(this, &PreviewActionGroup::triggered, this, &PreviewActionGroup::slotTriggered); setExclusive(true); const QString objNamePostfix = QStringLiteral("_action"); diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp index b1e9fdc2..3bb2ae5c 100644 --- a/src/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp @@ -2069,8 +2069,8 @@ void QDesignerResource::createResources(DomResources *resources) } else { resourceSet = m_formWindow->core()->resourceModel()->addResourceSet(paths); m_formWindow->setResourceSet(resourceSet); - QObject::connect(m_formWindow->core()->resourceModel(), SIGNAL(resourceSetActivated(QtResourceSet*,bool)), - m_formWindow, SLOT(resourceSetActivated(QtResourceSet*,bool))); + QObject::connect(m_formWindow->core()->resourceModel(), &QtResourceModel::resourceSetActivated, + m_formWindow, &FormWindowBase::resourceSetActivated); } } diff --git a/src/designer/src/components/formeditor/qdesignerundostack.cpp b/src/designer/src/components/formeditor/qdesignerundostack.cpp index 2aab4ec9..62ed7696 100644 --- a/src/designer/src/components/formeditor/qdesignerundostack.cpp +++ b/src/designer/src/components/formeditor/qdesignerundostack.cpp @@ -45,7 +45,7 @@ QDesignerUndoStack::QDesignerUndoStack(QObject *parent) : m_undoStack(new QUndoStack), m_fakeDirty(false) { - connect(m_undoStack, SIGNAL(indexChanged(int)), this, SIGNAL(changed())); + connect(m_undoStack, &QUndoStack::indexChanged, this, &QDesignerUndoStack::changed); } QDesignerUndoStack::~QDesignerUndoStack() diff --git a/src/designer/src/components/formeditor/templateoptionspage.cpp b/src/designer/src/components/formeditor/templateoptionspage.cpp index d5e8e171..90892a99 100644 --- a/src/designer/src/components/formeditor/templateoptionspage.cpp +++ b/src/designer/src/components/formeditor/templateoptionspage.cpp @@ -57,10 +57,12 @@ TemplateOptionsWidget::TemplateOptionsWidget(QDesignerFormEditorInterface *core, m_ui->m_removeTemplatePathButton->setIcon( qdesigner_internal::createIconSet(QString::fromUtf8("minus.png"))); - connect(m_ui->m_templatePathListWidget, SIGNAL(itemSelectionChanged()), - this, SLOT(templatePathSelectionChanged())); - connect(m_ui->m_addTemplatePathButton, SIGNAL(clicked()), this, SLOT(addTemplatePath())); - connect(m_ui->m_removeTemplatePathButton, SIGNAL(clicked()), this, SLOT(removeTemplatePath())); + connect(m_ui->m_templatePathListWidget, &QListWidget::itemSelectionChanged, + this, &TemplateOptionsWidget::templatePathSelectionChanged); + connect(m_ui->m_addTemplatePathButton, &QAbstractButton::clicked, + this, &TemplateOptionsWidget::addTemplatePath); + connect(m_ui->m_removeTemplatePathButton, &QAbstractButton::clicked, + this, &TemplateOptionsWidget::removeTemplatePath); } TemplateOptionsWidget::~TemplateOptionsWidget() diff --git a/src/designer/src/components/objectinspector/objectinspector.cpp b/src/designer/src/components/objectinspector/objectinspector.cpp index d4208439..b182a148 100644 --- a/src/designer/src/components/objectinspector/objectinspector.cpp +++ b/src/designer/src/components/objectinspector/objectinspector.cpp @@ -727,13 +727,14 @@ ObjectInspector::ObjectInspector(QDesignerFormEditorInterface *core, QWidget *pa QTreeView *treeView = m_impl->treeView(); vbox->addWidget(treeView); - connect(treeView, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(slotPopupContextMenu(QPoint))); + connect(treeView, &QWidget::customContextMenuRequested, + this, &ObjectInspector::slotPopupContextMenu); - connect(treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(slotSelectionChanged(QItemSelection,QItemSelection))); + connect(treeView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &ObjectInspector::slotSelectionChanged); - connect(treeView->header(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(slotHeaderDoubleClicked(int))); + connect(treeView->header(), &QHeaderView::sectionDoubleClicked, + this, &ObjectInspector::slotHeaderDoubleClicked); setAcceptDrops(true); ItemViewFindWidget *findWidget = m_impl->findWidget(); @@ -747,7 +748,7 @@ ObjectInspector::ObjectInspector(QDesignerFormEditorInterface *core, QWidget *pa findAction->setShortcut(QKeySequence::Find); findAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); addAction(findAction); - connect(findAction, SIGNAL(triggered(bool)), findWidget, SLOT(activate())); + connect(findAction, &QAction::triggered, findWidget, &AbstractFindWidget::activate); } ObjectInspector::~ObjectInspector() diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp index cd64497a..49908805 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp @@ -316,11 +316,11 @@ TextEditor::TextEditor(QDesignerFormEditorInterface *core, QWidget *parent) : m_layout->setMargin(0); m_layout->setSpacing(0); - connect(m_resourceAction, SIGNAL(triggered()), this, SLOT(resourceActionActivated())); - connect(m_fileAction, SIGNAL(triggered()), this, SLOT(fileActionActivated())); - connect(m_editor, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString))); - connect(m_themeEditor, SIGNAL(edited(QString)), this, SIGNAL(textChanged(QString))); - connect(m_button, SIGNAL(clicked()), this, SLOT(buttonClicked())); + connect(m_resourceAction, &QAction::triggered, this, &TextEditor::resourceActionActivated); + connect(m_fileAction, &QAction::triggered, this, &TextEditor::fileActionActivated); + connect(m_editor, &TextPropertyEditor::textChanged, this, &TextEditor::textChanged); + connect(m_themeEditor, &IconThemeEditor::edited, this, &TextEditor::textChanged); + connect(m_button, &QAbstractButton::clicked, this, &TextEditor::buttonClicked); setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); setFocusProxy(m_editor); @@ -482,8 +482,8 @@ IconThemeDialog::IconThemeDialog(QWidget *parent) layout->addWidget(m_editor); layout->addWidget(buttons); - connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); } QString IconThemeDialog::getTheme(QWidget *parent, const QString &theme, bool *ok) @@ -586,19 +586,20 @@ PixmapEditor::PixmapEditor(QDesignerFormEditorInterface *core, QWidget *parent) m_button->setMenu(menu); m_button->setText(tr("...")); - connect(m_button, SIGNAL(clicked()), this, SLOT(defaultActionActivated())); - connect(m_resourceAction, SIGNAL(triggered()), this, SLOT(resourceActionActivated())); - connect(m_fileAction, SIGNAL(triggered()), this, SLOT(fileActionActivated())); - connect(m_themeAction, SIGNAL(triggered()), this, SLOT(themeActionActivated())); + connect(m_button, &QAbstractButton::clicked, this, &PixmapEditor::defaultActionActivated); + connect(m_resourceAction, &QAction::triggered, this, &PixmapEditor::resourceActionActivated); + connect(m_fileAction, &QAction::triggered, this, &PixmapEditor::fileActionActivated); + connect(m_themeAction, &QAction::triggered, this, &PixmapEditor::themeActionActivated); #ifndef QT_NO_CLIPBOARD - connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copyActionActivated())); - connect(m_pasteAction, SIGNAL(triggered()), this, SLOT(pasteActionActivated())); + connect(m_copyAction, &QAction::triggered, this, &PixmapEditor::copyActionActivated); + connect(m_pasteAction, &QAction::triggered, this, &PixmapEditor::pasteActionActivated); #endif setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored)); setFocusProxy(m_button); #ifndef QT_NO_CLIPBOARD - connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); + connect(QApplication::clipboard(), &QClipboard::dataChanged, + this, &PixmapEditor::clipboardDataChanged); clipboardDataChanged(); #endif } @@ -800,7 +801,7 @@ ResetWidget::ResetWidget(QtProperty *property, QWidget *parent) : m_button->setIcon(createIconSet(QStringLiteral("resetproperty.png"))); m_button->setIconSize(QSize(8,8)); m_button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding)); - connect(m_button, SIGNAL(clicked()), this, SLOT(slotClicked())); + connect(m_button, &QAbstractButton::clicked, this, &ResetWidget::slotClicked); QLayout *layout = new QHBoxLayout(this); layout->setMargin(0); layout->setSpacing(m_spacing); @@ -870,8 +871,10 @@ DesignerPropertyManager::DesignerPropertyManager(QDesignerFormEditorInterface *c m_core(core), m_sourceOfChange(0) { - connect(this, SIGNAL(valueChanged(QtProperty*,QVariant)), this, SLOT(slotValueChanged(QtProperty*,QVariant))); - connect(this, SIGNAL(propertyDestroyed(QtProperty*)), this, SLOT(slotPropertyDestroyed(QtProperty*))); + connect(this, &QtVariantPropertyManager::valueChanged, + this, &DesignerPropertyManager::slotValueChanged); + connect(this, & QtAbstractPropertyManager::propertyDestroyed, + this, &DesignerPropertyManager::slotPropertyDestroyed); } DesignerPropertyManager::~DesignerPropertyManager() @@ -2191,7 +2194,8 @@ DesignerEditorFactory::DesignerEditorFactory(QDesignerFormEditorInterface *core, m_core(core), m_spacing(-1) { - connect(m_resetDecorator, SIGNAL(resetProperty(QtProperty*)), this, SIGNAL(resetProperty(QtProperty*))); + connect(m_resetDecorator, &ResetDecorator::resetProperty, + this, &DesignerEditorFactory::resetProperty); } DesignerEditorFactory::~DesignerEditorFactory() @@ -2225,24 +2229,24 @@ void DesignerEditorFactory::setFormWindowBase(qdesigner_internal::FormWindowBase void DesignerEditorFactory::connectPropertyManager(QtVariantPropertyManager *manager) { m_resetDecorator->connectPropertyManager(manager); - connect(manager, SIGNAL(attributeChanged(QtProperty*,QString,QVariant)), - this, SLOT(slotAttributeChanged(QtProperty*,QString,QVariant))); - connect(manager, SIGNAL(valueChanged(QtProperty*,QVariant)), - this, SLOT(slotValueChanged(QtProperty*,QVariant))); - connect(manager, SIGNAL(propertyChanged(QtProperty*)), - this, SLOT(slotPropertyChanged(QtProperty*))); + connect(manager, &QtVariantPropertyManager::attributeChanged, + this, &DesignerEditorFactory::slotAttributeChanged); + connect(manager, &QtVariantPropertyManager::valueChanged, + this, &DesignerEditorFactory::slotValueChanged); + connect(manager, &QtVariantPropertyManager::propertyChanged, + this, &DesignerEditorFactory::slotPropertyChanged); QtVariantEditorFactory::connectPropertyManager(manager); } void DesignerEditorFactory::disconnectPropertyManager(QtVariantPropertyManager *manager) { m_resetDecorator->disconnectPropertyManager(manager); - disconnect(manager, SIGNAL(attributeChanged(QtProperty*,QString,QVariant)), - this, SLOT(slotAttributeChanged(QtProperty*,QString,QVariant))); - disconnect(manager, SIGNAL(valueChanged(QtProperty*,QVariant)), - this, SLOT(slotValueChanged(QtProperty*,QVariant))); - disconnect(manager, SIGNAL(propertyChanged(QtProperty*)), - this, SLOT(slotPropertyChanged(QtProperty*))); + disconnect(manager, &QtVariantPropertyManager::attributeChanged, + this, &DesignerEditorFactory::slotAttributeChanged); + disconnect(manager, &QtVariantPropertyManager::valueChanged, + this, &DesignerEditorFactory::slotValueChanged); + disconnect(manager, &QtVariantPropertyManager::propertyChanged, + this, &DesignerEditorFactory::slotPropertyChanged); QtVariantEditorFactory::disconnectPropertyManager(manager); } @@ -2363,7 +2367,7 @@ TextEditor *DesignerEditorFactory::createTextEditor(QWidget *parent, TextPropert rc->setText(value); rc->setSpacing(m_spacing); rc->setTextPropertyValidationMode(vm); - connect(rc, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); + connect(rc, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); return rc; } @@ -2390,8 +2394,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setIconThemeModeEnabled(themeEnabled); m_stringPropertyToEditors[property].append(ed); m_editorToStringProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotStringTextChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &TextEditor::textChanged, this, &DesignerEditorFactory::slotStringTextChanged); editor = ed; } break; @@ -2400,8 +2404,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setSuperPalette(qvariant_cast<QPalette>(manager->attributeValue(property, QLatin1String(superPaletteAttributeC)))); m_palettePropertyToEditors[property].append(ed); m_editorToPaletteProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(paletteChanged(QPalette)), this, SLOT(slotPaletteChanged(QPalette))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &PaletteEditorButton::paletteChanged, this, &DesignerEditorFactory::slotPaletteChanged); editor = ed; } break; @@ -2411,8 +2415,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setText(QString::number(manager->value(property).toUInt())); m_uintPropertyToEditors[property].append(ed); m_editorToUintProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotUintChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &QLineEdit::textChanged, this, &DesignerEditorFactory::slotUintChanged); editor = ed; } break; @@ -2422,8 +2426,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setText(QString::number(manager->value(property).toLongLong())); m_longLongPropertyToEditors[property].append(ed); m_editorToLongLongProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotLongLongChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &QLineEdit::textChanged, this, &DesignerEditorFactory::slotLongLongChanged); editor = ed; } break; @@ -2433,8 +2437,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setText(QString::number(manager->value(property).toULongLong())); m_uLongLongPropertyToEditors[property].append(ed); m_editorToULongLongProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotULongLongChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &QLineEdit::textChanged, this, &DesignerEditorFactory::slotULongLongChanged); editor = ed; } break; @@ -2443,8 +2447,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setUpdateMode(TextPropertyEditor::UpdateOnFinished); m_urlPropertyToEditors[property].append(ed); m_editorToUrlProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotUrlChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &TextEditor::textChanged, this, &DesignerEditorFactory::slotUrlChanged); editor = ed; } break; @@ -2452,8 +2456,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, TextEditor *ed = createTextEditor(parent, ValidationMultiLine, QString::fromUtf8(manager->value(property).toByteArray())); m_byteArrayPropertyToEditors[property].append(ed); m_editorToByteArrayProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotByteArrayChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &TextEditor::textChanged, this, &DesignerEditorFactory::slotByteArrayChanged); editor = ed; } break; @@ -2466,8 +2470,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setSpacing(m_spacing); m_pixmapPropertyToEditors[property].append(ed); m_editorToPixmapProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(pathChanged(QString)), this, SLOT(slotPixmapChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &PixmapEditor::pathChanged, this, &DesignerEditorFactory::slotPixmapChanged); editor = ed; } else if (type == DesignerPropertyManager::designerIconTypeId()) { PixmapEditor *ed = new PixmapEditor(m_core, parent); @@ -2485,9 +2489,9 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setSpacing(m_spacing); m_iconPropertyToEditors[property].append(ed); m_editorToIconProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(pathChanged(QString)), this, SLOT(slotIconChanged(QString))); - connect(ed, SIGNAL(themeChanged(QString)), this, SLOT(slotIconThemeChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &PixmapEditor::pathChanged, this, &DesignerEditorFactory::slotIconChanged); + connect(ed, &PixmapEditor::themeChanged, this, &DesignerEditorFactory::slotIconThemeChanged); editor = ed; } else if (type == DesignerPropertyManager::designerStringTypeId()) { const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt()); @@ -2497,8 +2501,8 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont)); m_stringPropertyToEditors[property].append(ed); m_editorToStringProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotStringTextChanged(QString))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &TextEditor::textChanged, this, &DesignerEditorFactory::slotStringTextChanged); editor = ed; } else if (type == DesignerPropertyManager::designerStringListTypeId() || type == QVariant::StringList) { const QVariant variantValue = manager->value(property); @@ -2507,16 +2511,16 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, StringListEditorButton *ed = new StringListEditorButton(value, parent); m_stringListPropertyToEditors[property].append(ed); m_editorToStringListProperty.insert(ed, property); - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(stringListChanged(QStringList)), this, SLOT(slotStringListChanged(QStringList))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &StringListEditorButton::stringListChanged, this, &DesignerEditorFactory::slotStringListChanged); editor = ed; } else if (type == DesignerPropertyManager::designerKeySequenceTypeId()) { QKeySequenceEdit *ed = new QKeySequenceEdit(parent); ed->setKeySequence(qvariant_cast<PropertySheetKeySequenceValue>(manager->value(property)).value()); m_keySequencePropertyToEditors[property].append(ed); m_editorToKeySequenceProperty[ed] = property; - connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(ed, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(slotKeySequenceChanged(QKeySequence))); + connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed); + connect(ed, &QKeySequenceEdit::keySequenceChanged, this, &DesignerEditorFactory::slotKeySequenceChanged); editor = ed; } else { editor = QtVariantEditorFactory::createEditor(manager, property, parent); @@ -2740,14 +2744,14 @@ ResetDecorator::~ResetDecorator() void ResetDecorator::connectPropertyManager(QtAbstractPropertyManager *manager) { - connect(manager, SIGNAL(propertyChanged(QtProperty*)), - this, SLOT(slotPropertyChanged(QtProperty*))); + connect(manager, &QtAbstractPropertyManager::propertyChanged, + this, &ResetDecorator::slotPropertyChanged); } void ResetDecorator::disconnectPropertyManager(QtAbstractPropertyManager *manager) { - disconnect(manager, SIGNAL(propertyChanged(QtProperty*)), - this, SLOT(slotPropertyChanged(QtProperty*))); + disconnect(manager, &QtAbstractPropertyManager::propertyChanged, + this, &ResetDecorator::slotPropertyChanged); } void ResetDecorator::setSpacing(int spacing) @@ -2789,8 +2793,8 @@ QWidget *ResetDecorator::editor(QWidget *subEditor, bool resettable, QtAbstractP resetWidget->setValueText(property->valueText()); resetWidget->setValueIcon(property->valueIcon()); resetWidget->setAutoFillBackground(true); - connect(resetWidget, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); - connect(resetWidget, SIGNAL(resetProperty(QtProperty*)), this, SIGNAL(resetProperty(QtProperty*))); + connect(resetWidget, &QObject::destroyed, this, &ResetDecorator::slotEditorDestroyed); + connect(resetWidget, &ResetWidget::resetProperty, this, &ResetDecorator::resetProperty); m_createdResetWidgets[property].append(resetWidget); m_resetWidgetToProperty[resetWidget] = property; } diff --git a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp index 6408c107..7ef246ab 100644 --- a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp +++ b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp @@ -49,7 +49,7 @@ NewDynamicPropertyDialog::NewDynamicPropertyDialog(QDesignerDialogGuiInterface * m_ui(new Ui::NewDynamicPropertyDialog) { m_ui->setupUi(this); - connect(m_ui->m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(nameChanged(QString))); + connect(m_ui->m_lineEdit, &QLineEdit::textChanged, this, &NewDynamicPropertyDialog::nameChanged); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); diff --git a/src/designer/src/components/propertyeditor/paletteeditor.cpp b/src/designer/src/components/propertyeditor/paletteeditor.cpp index 9386fe21..32c98f69 100644 --- a/src/designer/src/components/propertyeditor/paletteeditor.cpp +++ b/src/designer/src/components/propertyeditor/paletteeditor.cpp @@ -68,8 +68,8 @@ PaletteEditor::PaletteEditor(QDesignerFormEditorInterface *core, QWidget *parent ColorDelegate *delegate = new ColorDelegate(core, this); ui.paletteView->setItemDelegate(delegate); ui.paletteView->setEditTriggers(QAbstractItemView::AllEditTriggers); - connect(m_paletteModel, SIGNAL(paletteChanged(QPalette)), - this, SLOT(paletteChanged(QPalette))); + connect(m_paletteModel, &PaletteModel::paletteChanged, + this, &PaletteEditor::paletteChanged); ui.paletteView->setSelectionBehavior(QAbstractItemView::SelectRows); ui.paletteView->setDragEnabled(true); ui.paletteView->setDropIndicatorShown(true); @@ -416,7 +416,7 @@ BrushEditor::BrushEditor(QDesignerFormEditorInterface *core, QWidget *parent) : QLayout *layout = new QHBoxLayout(this); layout->setMargin(0); layout->addWidget(m_button); - connect(m_button, SIGNAL(colorChanged(QColor)), this, SLOT(brushChanged())); + connect(m_button, &QtColorButton::colorChanged, this, &BrushEditor::brushChanged); setFocusProxy(m_button); } @@ -464,7 +464,7 @@ RoleEditor::RoleEditor(QWidget *parent) : button->setIconSize(QSize(8,8)); button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding)); layout->addWidget(button); - connect(button, SIGNAL(clicked()), this, SLOT(emitResetProperty())); + connect(button, &QAbstractButton::clicked, this, &RoleEditor::emitResetProperty); } void RoleEditor::setLabel(const QString &label) @@ -506,13 +506,16 @@ QWidget *ColorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem QWidget *ed = 0; if (index.column() == 0) { RoleEditor *editor = new RoleEditor(parent); - connect(editor, SIGNAL(changed(QWidget*)), this, SIGNAL(commitData(QWidget*))); + connect(editor, &RoleEditor::changed, this, &ColorDelegate::commitData); //editor->setFocusPolicy(Qt::NoFocus); //editor->installEventFilter(const_cast<ColorDelegate *>(this)); ed = editor; } else { + typedef void (BrushEditor::*BrushEditorWidgetSignal)(QWidget *); + BrushEditor *editor = new BrushEditor(m_core, parent); - connect(editor, SIGNAL(changed(QWidget*)), this, SIGNAL(commitData(QWidget*))); + connect(editor, static_cast<BrushEditorWidgetSignal>(&BrushEditor::changed), + this, &ColorDelegate::commitData); editor->setFocusPolicy(Qt::NoFocus); editor->installEventFilter(const_cast<ColorDelegate *>(this)); ed = editor; diff --git a/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp b/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp index e81b1473..19e454f1 100644 --- a/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp +++ b/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp @@ -49,7 +49,7 @@ PaletteEditorButton::PaletteEditorButton(QDesignerFormEditorInterface *core, con setText(tr("Change Palette")); setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - connect(this, SIGNAL(clicked()), this, SLOT(showPaletteEditor())); + connect(this, &QAbstractButton::clicked, this, &PaletteEditorButton::showPaletteEditor); } PaletteEditorButton::~PaletteEditorButton() diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp index 05f552d1..75ecf70b 100644 --- a/src/designer/src/components/propertyeditor/propertyeditor.cpp +++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp @@ -261,11 +261,13 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare actionGroup->addAction(m_treeAction); actionGroup->addAction(m_buttonAction); - connect(actionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotViewTriggered(QAction*))); + connect(actionGroup, &QActionGroup::triggered, + this, &PropertyEditor::slotViewTriggered); // Add actions QActionGroup *addDynamicActionGroup = new QActionGroup(this); - connect(addDynamicActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotAddDynamicProperty(QAction*))); + connect(addDynamicActionGroup, &QActionGroup::triggered, + this, &PropertyEditor::slotAddDynamicProperty); QMenu *addDynamicActionMenu = new QMenu(this); m_addDynamicAction->setMenu(addDynamicActionMenu); @@ -282,7 +284,7 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare addDynamicActionMenu->addAction(addDynamicAction); // remove m_removeDynamicAction->setEnabled(false); - connect(m_removeDynamicAction, SIGNAL(triggered()), this, SLOT(slotRemoveDynamicProperty())); + connect(m_removeDynamicAction, &QAction::triggered, this, &PropertyEditor::slotRemoveDynamicProperty); // Configure QAction *configureAction = new QAction(tr("Configure Property Editor"), this); configureAction->setIcon(createIconSet(QStringLiteral("configure.png"))); @@ -290,10 +292,10 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare configureAction->setMenu(configureMenu); m_sortingAction->setCheckable(true); - connect(m_sortingAction, SIGNAL(toggled(bool)), this, SLOT(slotSorting(bool))); + connect(m_sortingAction, &QAction::toggled, this, &PropertyEditor::slotSorting); m_coloringAction->setCheckable(true); - connect(m_coloringAction, SIGNAL(toggled(bool)), this, SLOT(slotColoring(bool))); + connect(m_coloringAction, &QAction::toggled, this, &PropertyEditor::slotColoring); configureMenu->addAction(m_sortingAction); configureMenu->addAction(m_coloringAction); @@ -314,17 +316,19 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare buttonScroll->setWidgetResizable(true); buttonScroll->setWidget(m_buttonBrowser); m_buttonIndex = m_stackedWidget->addWidget(buttonScroll); - connect(m_buttonBrowser, SIGNAL(currentItemChanged(QtBrowserItem*)), this, SLOT(slotCurrentItemChanged(QtBrowserItem*))); + connect(m_buttonBrowser, &QtAbstractPropertyBrowser::currentItemChanged, + this, &PropertyEditor::slotCurrentItemChanged); m_treeBrowser = new QtTreePropertyBrowser(m_stackedWidget); m_treeBrowser->setRootIsDecorated(false); m_treeBrowser->setPropertiesWithoutValueMarked(true); m_treeBrowser->setResizeMode(QtTreePropertyBrowser::Interactive); m_treeIndex = m_stackedWidget->addWidget(m_treeBrowser); - connect(m_treeBrowser, SIGNAL(currentItemChanged(QtBrowserItem*)), this, SLOT(slotCurrentItemChanged(QtBrowserItem*))); + connect(m_treeBrowser, &QtAbstractPropertyBrowser::currentItemChanged, + this, &PropertyEditor::slotCurrentItemChanged); m_filterWidget->setPlaceholderText(tr("Filter")); m_filterWidget->setClearButtonEnabled(true); - connect(m_filterWidget, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); + connect(m_filterWidget, &QLineEdit::textChanged, this, &PropertyEditor::setFilter); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(toolBar); @@ -345,9 +349,12 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare m_currentBrowser = m_treeBrowser; m_treeAction->setChecked(true); - connect(m_groupFactory, SIGNAL(resetProperty(QtProperty*)), this, SLOT(slotResetProperty(QtProperty*))); - connect(m_treeFactory, SIGNAL(resetProperty(QtProperty*)), this, SLOT(slotResetProperty(QtProperty*))); - connect(variantManager, SIGNAL(valueChanged(QtProperty*,QVariant,bool)), this, SLOT(slotValueChanged(QtProperty*,QVariant,bool))); + connect(m_groupFactory, &DesignerEditorFactory::resetProperty, + this, &PropertyEditor::slotResetProperty); + connect(m_treeFactory, &DesignerEditorFactory::resetProperty, + this, &PropertyEditor::slotResetProperty); + connect(m_propertyManager, &DesignerPropertyManager::valueChanged, + this, &PropertyEditor::slotValueChanged); // retrieve initial settings QDesignerSettingsInterface *settings = m_core->settingsManager(); diff --git a/src/designer/src/components/propertyeditor/stringlisteditor.cpp b/src/designer/src/components/propertyeditor/stringlisteditor.cpp index 11eaba63..1af9458f 100644 --- a/src/designer/src/components/propertyeditor/stringlisteditor.cpp +++ b/src/designer/src/components/propertyeditor/stringlisteditor.cpp @@ -47,11 +47,11 @@ StringListEditor::StringListEditor(QWidget *parent) listView->setModel(m_model); connect(listView->selectionModel(), - SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(currentIndexChanged(QModelIndex,QModelIndex))); + &QItemSelectionModel::currentChanged, + this, &StringListEditor::currentIndexChanged); connect(listView->itemDelegate(), - SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), - this, SLOT(currentValueChanged())); + &QAbstractItemDelegate::closeEditor, + this, &StringListEditor::currentValueChanged); QIcon upIcon = createIconSet(QString::fromUtf8("up.png")); QIcon downIcon = createIconSet(QString::fromUtf8("down.png")); diff --git a/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp b/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp index d5e7e565..59fbcd6c 100644 --- a/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp +++ b/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp @@ -48,7 +48,7 @@ StringListEditorButton::StringListEditorButton( setText(tr("Change String List")); setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - connect(this, SIGNAL(clicked()), this, SLOT(showStringListEditor())); + connect(this, &QAbstractButton::clicked, this, &StringListEditorButton::showStringListEditor); } StringListEditorButton::~StringListEditorButton() diff --git a/src/designer/src/components/signalsloteditor/connectdialog.cpp b/src/designer/src/components/signalsloteditor/connectdialog.cpp index 96ae3637..6eb7870c 100644 --- a/src/designer/src/components/signalsloteditor/connectdialog.cpp +++ b/src/designer/src/components/signalsloteditor/connectdialog.cpp @@ -84,27 +84,29 @@ ConnectDialog::ConnectDialog(QDesignerFormWindowInterface *formWindow, setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - connect(m_ui.signalList, SIGNAL(itemClicked(QListWidgetItem*)), - this, SLOT(selectSignal(QListWidgetItem*))); - connect(m_ui.slotList, SIGNAL(itemClicked(QListWidgetItem*)), - this, SLOT(selectSlot(QListWidgetItem*))); + connect(m_ui.signalList, &QListWidget::itemClicked, + this, &ConnectDialog::selectSignal); + connect(m_ui.slotList, &QListWidget::itemClicked, + this, &ConnectDialog::selectSlot); m_ui.slotList->setEnabled(false); QPushButton *ok_button = okButton(); ok_button->setDefault(true); ok_button->setEnabled(false); - connect(m_ui.showAllCheckBox, SIGNAL(toggled(bool)), this, SLOT(populateLists())); + connect(m_ui.showAllCheckBox, &QCheckBox::toggled, this, &ConnectDialog::populateLists); QDesignerFormEditorInterface *core = m_formWindow->core(); m_ui.signalGroupBox->setTitle(widgetLabel(core, source)); m_ui.slotGroupBox->setTitle(widgetLabel(core, destination)); m_ui.editSignalsButton->setEnabled(m_sourceMode != NormalWidget); - connect(m_ui.editSignalsButton, SIGNAL(clicked()), this, SLOT(editSignals())); + connect(m_ui.editSignalsButton, &QAbstractButton::clicked, + this, &ConnectDialog::editSignals); m_ui.editSlotsButton->setEnabled(m_destinationMode != NormalWidget); - connect(m_ui.editSlotsButton, SIGNAL(clicked()), this, SLOT(editSlots())); + connect(m_ui.editSlotsButton, &QAbstractButton::clicked, + this, &ConnectDialog::editSlots); populateLists(); } diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp index 631ea4c9..0a33b75e 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp @@ -73,14 +73,14 @@ void SignalSlotEditorPlugin::initialize(QDesignerFormEditorInterface *core) m_core = core; m_initialized = true; - connect(core->formWindowManager(), SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)), - this, SLOT(addFormWindow(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowAdded, + this, &SignalSlotEditorPlugin::addFormWindow); - connect(core->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)), - this, SLOT(removeFormWindow(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowRemoved, + this, &SignalSlotEditorPlugin::removeFormWindow); - connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), - this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + this, &SignalSlotEditorPlugin::activeFormWindowChanged); } QDesignerFormEditorInterface *SignalSlotEditorPlugin::core() const @@ -94,7 +94,7 @@ void SignalSlotEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWin Q_ASSERT(m_tools.contains(formWindow) == false); SignalSlotEditorTool *tool = new SignalSlotEditorTool(formWindow, this); - connect(m_action, SIGNAL(triggered()), tool->action(), SLOT(trigger())); + connect(m_action, &QAction::triggered, tool->action(), &QAction::trigger); m_tools[formWindow] = tool; formWindow->registerTool(tool); } @@ -106,7 +106,7 @@ void SignalSlotEditorPlugin::removeFormWindow(QDesignerFormWindowInterface *form SignalSlotEditorTool *tool = m_tools.value(formWindow); m_tools.remove(formWindow); - disconnect(m_action, SIGNAL(triggered()), tool->action(), SLOT(trigger())); + disconnect(m_action, &QAction::triggered, tool->action(), &QAction::trigger); // ### FIXME disable the tool delete tool; diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp index 06ef4ac6..e11eadca 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp @@ -79,9 +79,10 @@ QWidget *SignalSlotEditorTool::editor() const if (!m_editor) { Q_ASSERT(formWindow() != 0); m_editor = new qdesigner_internal::SignalSlotEditor(formWindow(), 0); - connect(formWindow(), SIGNAL(mainContainerChanged(QWidget*)), m_editor, SLOT(setBackground(QWidget*))); - connect(formWindow(), SIGNAL(changed()), - m_editor, SLOT(updateBackground())); + connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged, + m_editor.data(), &SignalSlotEditor::setBackground); + connect(formWindow(), &QDesignerFormWindowInterface::changed, + m_editor.data(), &SignalSlotEditor::updateBackground); } return m_editor; diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index ecc8a2d8..b3696611 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -70,6 +70,8 @@ QT_BEGIN_NAMESPACE +typedef void (QComboBox::*QComboIntSignal)(int); + // Add suitable form widgets to a list of objects for the signal slot // editor. Prevent special widgets from showing up there. static void addWidgetToObjectList(const QWidget *w, QStringList &r) @@ -155,29 +157,29 @@ void ConnectionModel::setEditor(SignalSlotEditor *editor) beginResetModel(); if (m_editor) { - disconnect(m_editor, SIGNAL(connectionAdded(Connection*)), - this, SLOT(connectionAdded(Connection*))); - disconnect(m_editor, SIGNAL(connectionRemoved(int)), - this, SLOT(connectionRemoved(int))); - disconnect(m_editor, SIGNAL(aboutToRemoveConnection(Connection*)), - this, SLOT(aboutToRemoveConnection(Connection*))); - disconnect(m_editor, SIGNAL(aboutToAddConnection(int)), - this, SLOT(aboutToAddConnection(int))); - disconnect(m_editor, SIGNAL(connectionChanged(Connection*)), - this, SLOT(connectionChanged(Connection*))); + disconnect(m_editor.data(), &SignalSlotEditor::connectionAdded, + this, &ConnectionModel::connectionAdded); + disconnect(m_editor.data(), &SignalSlotEditor::connectionRemoved, + this, &ConnectionModel::connectionRemoved); + disconnect(m_editor.data(), &SignalSlotEditor::aboutToRemoveConnection, + this, &ConnectionModel::aboutToRemoveConnection); + disconnect(m_editor.data(), &SignalSlotEditor::aboutToAddConnection, + this, &ConnectionModel::aboutToAddConnection); + disconnect(m_editor.data(), &SignalSlotEditor::connectionChanged, + this, &ConnectionModel::connectionChanged); } m_editor = editor; if (m_editor) { - connect(m_editor, SIGNAL(connectionAdded(Connection*)), - this, SLOT(connectionAdded(Connection*))); - connect(m_editor, SIGNAL(connectionRemoved(int)), - this, SLOT(connectionRemoved(int))); - connect(m_editor, SIGNAL(aboutToRemoveConnection(Connection*)), - this, SLOT(aboutToRemoveConnection(Connection*))); - connect(m_editor, SIGNAL(aboutToAddConnection(int)), - this, SLOT(aboutToAddConnection(int))); - connect(m_editor, SIGNAL(connectionChanged(Connection*)), - this, SLOT(connectionChanged(Connection*))); + connect(m_editor.data(), &SignalSlotEditor::connectionAdded, + this, &ConnectionModel::connectionAdded); + connect(m_editor.data(), &SignalSlotEditor::connectionRemoved, + this, &ConnectionModel::connectionRemoved); + connect(m_editor.data(), &SignalSlotEditor::aboutToRemoveConnection, + this, &ConnectionModel::aboutToRemoveConnection); + connect(m_editor.data(), &SignalSlotEditor::aboutToAddConnection, + this, &ConnectionModel::aboutToAddConnection); + connect(m_editor.data(), &SignalSlotEditor::connectionChanged, + this, &ConnectionModel::connectionChanged); } endResetModel(); } @@ -524,7 +526,8 @@ InlineEditor::InlineEditor(QWidget *parent) : setModel(m_model = new InlineEditorModel(0, 4, this)); setFrame(false); m_idx = -1; - connect(this, SIGNAL(activated(int)), this, SLOT(checkSelection(int))); + connect(this, static_cast<QComboIntSignal>(&QComboBox::activated), + this, &InlineEditor::checkSelection); } void InlineEditor::checkSelection(int idx) @@ -661,7 +664,8 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, break; } - connect(inline_editor, SIGNAL(activated(int)), this, SLOT(emitCommitData())); + connect(inline_editor, static_cast<QComboIntSignal>(&QComboBox::activated), + this, &ConnectionDelegate::emitCommitData); return inline_editor; } @@ -700,8 +704,10 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor | QAbstractItemView::EditKeyPressed); m_view->setRootIsDecorated(false); m_view->setTextElideMode (Qt::ElideMiddle); - connect(m_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateUi())); - connect(m_view->header(), SIGNAL(sectionDoubleClicked(int)), m_view, SLOT(resizeColumnToContents(int))); + connect(m_view->selectionModel(), &QItemSelectionModel::currentChanged, + this, &SignalSlotEditorWindow::updateUi); + connect(m_view->header(), &QHeaderView::sectionDoubleClicked, + m_view, &QTreeView::resizeColumnToContents); QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); @@ -710,19 +716,19 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor QToolBar *toolBar = new QToolBar; toolBar->setIconSize(QSize(22, 22)); m_add_button->setIcon(createIconSet(QStringLiteral("plus.png"))); - connect(m_add_button, SIGNAL(clicked()), this, SLOT(addConnection())); + connect(m_add_button, &QAbstractButton::clicked, this, &SignalSlotEditorWindow::addConnection); toolBar->addWidget(m_add_button); m_remove_button->setIcon(createIconSet(QStringLiteral("minus.png"))); - connect(m_remove_button, SIGNAL(clicked()), this, SLOT(removeConnection())); + connect(m_remove_button, &QAbstractButton::clicked, this, &SignalSlotEditorWindow::removeConnection); toolBar->addWidget(m_remove_button); layout->addWidget(toolBar); layout->addWidget(m_view); connect(core->formWindowManager(), - SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), - this, SLOT(setActiveFormWindow(QDesignerFormWindowInterface*))); + &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + this, &SignalSlotEditorWindow::setActiveFormWindow); updateUi(); } @@ -733,13 +739,13 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f if (!m_editor.isNull()) { disconnect(m_view->selectionModel(), - SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(updateEditorSelection(QModelIndex))); - disconnect(m_editor, SIGNAL(connectionSelected(Connection*)), - this, SLOT(updateDialogSelection(Connection*))); + &QItemSelectionModel::currentChanged, + this, &SignalSlotEditorWindow::updateEditorSelection); + disconnect(m_editor.data(), &SignalSlotEditor::connectionSelected, + this, &SignalSlotEditorWindow::updateDialogSelection); if (integration) { - disconnect(integration, SIGNAL(objectNameChanged(QDesignerFormWindowInterface*,QObject*,QString,QString)), - this, SLOT(objectNameChanged(QDesignerFormWindowInterface*,QObject*,QString,QString))); + disconnect(integration, &QDesignerIntegrationInterface::objectNameChanged, + this, &SignalSlotEditorWindow::objectNameChanged); } } @@ -752,13 +758,13 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f delegate->setForm(form); connect(m_view->selectionModel(), - SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(updateEditorSelection(QModelIndex))); - connect(m_editor, SIGNAL(connectionSelected(Connection*)), - this, SLOT(updateDialogSelection(Connection*))); + &QItemSelectionModel::currentChanged, + this, &SignalSlotEditorWindow::updateEditorSelection); + connect(m_editor.data(), &SignalSlotEditor::connectionSelected, + this, &SignalSlotEditorWindow::updateDialogSelection); if (integration) { - connect(integration, SIGNAL(objectNameChanged(QDesignerFormWindowInterface*,QObject*,QString,QString)), - this, SLOT(objectNameChanged(QDesignerFormWindowInterface*,QObject*,QString,QString))); + connect(integration, &QDesignerIntegrationInterface::objectNameChanged, + this, &SignalSlotEditorWindow::objectNameChanged); } } diff --git a/src/designer/src/components/tabordereditor/tabordereditor.cpp b/src/designer/src/components/tabordereditor/tabordereditor.cpp index 67f0f744..3233e0a2 100644 --- a/src/designer/src/components/tabordereditor/tabordereditor.cpp +++ b/src/designer/src/components/tabordereditor/tabordereditor.cpp @@ -76,7 +76,7 @@ TabOrderEditor::TabOrderEditor(QDesignerFormWindowInterface *form, QWidget *pare m_current_index(0), m_beginning(true) { - connect(form, SIGNAL(widgetRemoved(QWidget*)), this, SLOT(widgetRemoved(QWidget*))); + connect(form, &QDesignerFormWindowInterface::widgetRemoved, this, &TabOrderEditor::widgetRemoved); QFont tabFont = font(); tabFont.setPointSize(tabFont.pointSize()*2); diff --git a/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp b/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp index 5bbadb28..6f115957 100644 --- a/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp +++ b/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp @@ -73,14 +73,14 @@ void TabOrderEditorPlugin::initialize(QDesignerFormEditorInterface *core) m_core = core; m_initialized = true; - connect(core->formWindowManager(), SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)), - this, SLOT(addFormWindow(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowAdded, + this, &TabOrderEditorPlugin::addFormWindow); - connect(core->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)), - this, SLOT(removeFormWindow(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowRemoved, + this, &TabOrderEditorPlugin::removeFormWindow); - connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), - this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*))); + connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + this, &TabOrderEditorPlugin::activeFormWindowChanged); } void TabOrderEditorPlugin::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow) @@ -100,7 +100,7 @@ void TabOrderEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWindo TabOrderEditorTool *tool = new TabOrderEditorTool(formWindow, this); m_tools[formWindow] = tool; - connect(m_action, SIGNAL(triggered()), tool->action(), SLOT(trigger())); + connect(m_action, &QAction::triggered, tool->action(), &QAction::trigger); formWindow->registerTool(tool); } @@ -111,7 +111,7 @@ void TabOrderEditorPlugin::removeFormWindow(QDesignerFormWindowInterface *formWi TabOrderEditorTool *tool = m_tools.value(formWindow); m_tools.remove(formWindow); - disconnect(m_action, SIGNAL(triggered()), tool->action(), SLOT(trigger())); + disconnect(m_action, &QAction::triggered, tool->action(), &QAction::trigger); // ### FIXME disable the tool delete tool; diff --git a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp index 3686b721..f4dc6bb3 100644 --- a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp +++ b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp @@ -80,7 +80,8 @@ QWidget *TabOrderEditorTool::editor() const if (!m_editor) { Q_ASSERT(formWindow() != 0); m_editor = new TabOrderEditor(formWindow(), 0); - connect(formWindow(), SIGNAL(mainContainerChanged(QWidget*)), m_editor, SLOT(setBackground(QWidget*))); + connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged, + m_editor.data(), &TabOrderEditor::setBackground); } return m_editor; @@ -88,14 +89,14 @@ QWidget *TabOrderEditorTool::editor() const void TabOrderEditorTool::activated() { - connect(formWindow(), SIGNAL(changed()), - m_editor, SLOT(updateBackground())); + connect(formWindow(), &QDesignerFormWindowInterface::changed, + m_editor.data(), &TabOrderEditor::updateBackground); } void TabOrderEditorTool::deactivated() { - disconnect(formWindow(), SIGNAL(changed()), - m_editor, SLOT(updateBackground())); + disconnect(formWindow(), &QDesignerFormWindowInterface::changed, + m_editor.data(), &TabOrderEditor::updateBackground); } QAction *TabOrderEditorTool::action() const diff --git a/src/designer/src/components/taskmenu/button_taskmenu.cpp b/src/designer/src/components/taskmenu/button_taskmenu.cpp index eaa56e98..0213803b 100644 --- a/src/designer/src/components/taskmenu/button_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/button_taskmenu.cpp @@ -313,8 +313,8 @@ ButtonGroupMenu::ButtonGroupMenu(QObject *parent) : m_buttonGroup(0), m_currentButton(0) { - connect(m_breakGroupAction, SIGNAL(triggered()), this, SLOT(breakGroup())); - connect(m_selectGroupAction, SIGNAL(triggered()), this, SLOT(selectGroup())); + connect(m_breakGroupAction, &QAction::triggered, this, &ButtonGroupMenu::breakGroup); + connect(m_selectGroupAction, &QAction::triggered, this, &ButtonGroupMenu::selectGroup); } void ButtonGroupMenu::initialize(QDesignerFormWindowInterface *formWindow, QButtonGroup *buttonGroup, QAbstractButton *currentButton) @@ -436,10 +436,10 @@ ButtonTaskMenu::ButtonTaskMenu(QAbstractButton *button, QObject *parent) : m_preferredEditAction(new QAction(tr("Change text..."), this)), m_removeFromGroupAction(new QAction(tr("None"), this)) { - connect(m_createGroupAction, SIGNAL(triggered()), this, SLOT(createGroup())); + connect(m_createGroupAction, &QAction::triggered, this, &ButtonTaskMenu::createGroup); TaskMenuInlineEditor *textEditor = new ButtonTextTaskMenuInlineEditor(button, this); - connect(m_preferredEditAction, SIGNAL(triggered()), textEditor, SLOT(editText())); - connect(m_removeFromGroupAction, SIGNAL(triggered()), this, SLOT(removeFromGroup())); + connect(m_preferredEditAction, &QAction::triggered, textEditor, &TaskMenuInlineEditor::editText); + connect(m_removeFromGroupAction, &QAction::triggered, this, &ButtonTaskMenu::removeFromGroup); m_assignToGroupSubMenuAction->setMenu(m_assignGroupSubMenu); @@ -493,7 +493,7 @@ bool ButtonTaskMenu::refreshAssignMenu(const QDesignerFormWindowInterface *fw, i m_assignGroupSubMenu->addSeparator(); // Create a new action group m_assignActionGroup = new QActionGroup(this); - connect(m_assignActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(addToGroup(QAction*))); + connect(m_assignActionGroup, &QActionGroup::triggered, this, &ButtonTaskMenu::addToGroup); const ButtonGroupList::const_iterator cend = bl.constEnd(); for (ButtonGroupList::const_iterator it = bl.constBegin(); it != cend; ++it) { @@ -692,7 +692,7 @@ CommandLinkButtonTaskMenu::CommandLinkButtonTaskMenu(QCommandLinkButton *button, { TaskMenuInlineEditor *descriptonEditor = new LinkDescriptionTaskMenuInlineEditor(button, this); QAction *descriptionAction = new QAction(tr("Change description..."), this); - connect(descriptionAction, SIGNAL(triggered()), descriptonEditor, SLOT(editText())); + connect(descriptionAction, &QAction::triggered, descriptonEditor, &TaskMenuInlineEditor::editText); insertAction(1, descriptionAction); } diff --git a/src/designer/src/components/taskmenu/combobox_taskmenu.cpp b/src/designer/src/components/taskmenu/combobox_taskmenu.cpp index c3b5df06..e0562963 100644 --- a/src/designer/src/components/taskmenu/combobox_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/combobox_taskmenu.cpp @@ -58,7 +58,7 @@ ComboBoxTaskMenu::ComboBoxTaskMenu(QComboBox *button, QObject *parent) { m_editItemsAction = new QAction(this); m_editItemsAction->setText(tr("Edit Items...")); - connect(m_editItemsAction, SIGNAL(triggered()), this, SLOT(editItems())); + connect(m_editItemsAction, &QAction::triggered, this, &ComboBoxTaskMenu::editItems); m_taskActions.append(m_editItemsAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp b/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp index f4f58601..90a49a07 100644 --- a/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp @@ -74,9 +74,9 @@ ContainerWidgetTaskMenu::ContainerWidgetTaskMenu(QWidget *widget, ContainerType Q_ASSERT(m_core); m_taskActions.append(createSeparator()); - connect(m_actionDeletePage, SIGNAL(triggered()), this, SLOT(removeCurrentPage())); + connect(m_actionDeletePage, &QAction::triggered, this, &ContainerWidgetTaskMenu::removeCurrentPage); - connect(m_actionInsertPageAfter, SIGNAL(triggered()), this, SLOT(addPageAfter())); + connect(m_actionInsertPageAfter, &QAction::triggered, this, &ContainerWidgetTaskMenu::addPageAfter); // Empty Per-Page submenu, deletion and promotion. Updated on demand due to promotion state switch (m_type) { case WizardContainer: @@ -97,7 +97,7 @@ ContainerWidgetTaskMenu::ContainerWidgetTaskMenu(QWidget *widget, ContainerType QMenu *insertMenu = new QMenu; // before m_actionInsertPage = new QAction(tr("Insert Page Before Current Page"), this); - connect(m_actionInsertPage, SIGNAL(triggered()), this, SLOT(addPage())); + connect(m_actionInsertPage, &QAction::triggered, this, &ContainerWidgetTaskMenu::addPage); insertMenu->addAction(m_actionInsertPage); // after m_actionInsertPageAfter->setText(tr("Insert Page After Current Page")); @@ -229,8 +229,8 @@ WizardContainerWidgetTaskMenu::WizardContainerWidgetTaskMenu(QWizard *w, QObject m_nextAction(new QAction(tr("Next"), this)), m_previousAction(new QAction(tr("Back"), this)) { - connect(m_nextAction, SIGNAL(triggered()), w, SLOT(next())); - connect(m_previousAction, SIGNAL(triggered()), w, SLOT(back())); + connect(m_nextAction, &QAction::triggered, w, &QWizard::next); + connect(m_previousAction, &QAction::triggered, w, &QWizard::back); QList<QAction*> &l = containerActions(); l.push_front(createSeparator()); l.push_front(m_nextAction); @@ -254,10 +254,10 @@ MdiContainerWidgetTaskMenu::MdiContainerWidgetTaskMenu(QMdiArea *m, QObject *par ContainerWidgetTaskMenu(m, MdiContainer, parent) { initializeActions(); - connect(m_nextAction, SIGNAL(triggered()), m, SLOT(activateNextSubWindow())); - connect(m_previousAction, SIGNAL(triggered()), m , SLOT(activatePreviousSubWindow())); - connect(m_tileAction, SIGNAL(triggered()), m, SLOT(tileSubWindows())); - connect(m_cascadeAction, SIGNAL(triggered()), m, SLOT(cascadeSubWindows())); + connect(m_nextAction, &QAction::triggered, m, &QMdiArea::activateNextSubWindow); + connect(m_previousAction, &QAction::triggered, m , &QMdiArea::activatePreviousSubWindow); + connect(m_tileAction, &QAction::triggered, m, &QMdiArea::tileSubWindows); + connect(m_cascadeAction, &QAction::triggered, m, &QMdiArea::cascadeSubWindows); } void MdiContainerWidgetTaskMenu::initializeActions() diff --git a/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp b/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp index 43f3eeeb..87d089d7 100644 --- a/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp @@ -75,7 +75,7 @@ GroupBoxTaskMenu::GroupBoxTaskMenu(QGroupBox *groupbox, QObject *parent) { TaskMenuInlineEditor *editor = new GroupBoxTaskMenuInlineEditor(groupbox, this); - connect(m_editTitleAction, SIGNAL(triggered()), editor, SLOT(editText())); + connect(m_editTitleAction, &QAction::triggered, editor, &TaskMenuInlineEditor::editText); m_taskActions.append(m_editTitleAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/inplace_editor.cpp b/src/designer/src/components/taskmenu/inplace_editor.cpp index 901f6210..22993e2a 100644 --- a/src/designer/src/components/taskmenu/inplace_editor.cpp +++ b/src/designer/src/components/taskmenu/inplace_editor.cpp @@ -67,7 +67,7 @@ InPlaceEditor::InPlaceEditor(QWidget *widget, setFocus(); show(); - connect(this, SIGNAL(editingFinished()),this, SLOT(close())); + connect(this, &TextPropertyEditor::editingFinished,this, &QWidget::close); } @@ -90,7 +90,8 @@ void TaskMenuInlineEditor::editText() return; m_managed = m_formWindow->isManaged(m_widget); // Close as soon as a different widget is selected - connect(m_formWindow, SIGNAL(selectionChanged()), this, SLOT(updateSelection())); + connect(m_formWindow.data(), &QDesignerFormWindowInterface::selectionChanged, + this, &TaskMenuInlineEditor::updateSelection); // get old value QDesignerFormEditorInterface *core = m_formWindow->core(); @@ -102,7 +103,7 @@ void TaskMenuInlineEditor::editText() const QString oldValue = m_value.value(); m_editor = new InPlaceEditor(m_widget, m_vm, m_formWindow, oldValue, editRectangle()); - connect(m_editor, SIGNAL(textChanged(QString)), this, SLOT(updateText(QString))); + connect(m_editor.data(), &InPlaceEditor::textChanged, this, &TaskMenuInlineEditor::updateText); } void TaskMenuInlineEditor::updateText(const QString &text) diff --git a/src/designer/src/components/taskmenu/inplace_widget_helper.cpp b/src/designer/src/components/taskmenu/inplace_widget_helper.cpp index a3b55818..faad11d0 100644 --- a/src/designer/src/components/taskmenu/inplace_widget_helper.cpp +++ b/src/designer/src/components/taskmenu/inplace_widget_helper.cpp @@ -48,11 +48,14 @@ namespace qdesigner_internal { m_parentWidget(parentWidget), m_noChildEvent(m_parentWidget->testAttribute(Qt::WA_NoChildEventsForParent)) { + typedef void (QWidget::*QWidgetVoidSlot)(); + m_editorWidget->setAttribute(Qt::WA_DeleteOnClose); m_editorWidget->setParent(m_parentWidget->window()); m_parentWidget->installEventFilter(this); m_editorWidget->installEventFilter(this); - connect(m_editorWidget, SIGNAL(destroyed()), fw->mainContainer(), SLOT(setFocus())); + connect(m_editorWidget, &QObject::destroyed, + fw->mainContainer(), static_cast<QWidgetVoidSlot>(&QWidget::setFocus)); } InPlaceWidgetHelper::~InPlaceWidgetHelper() diff --git a/src/designer/src/components/taskmenu/itemlisteditor.cpp b/src/designer/src/components/taskmenu/itemlisteditor.cpp index febc5240..92738bad 100644 --- a/src/designer/src/components/taskmenu/itemlisteditor.cpp +++ b/src/designer/src/components/taskmenu/itemlisteditor.cpp @@ -84,11 +84,11 @@ AbstractItemEditor::AbstractItemEditor(QDesignerFormWindowInterface *form, QWidg m_propertyBrowser->setFactoryForManager((QtVariantPropertyManager *)m_propertyManager, m_editorFactory); - connect(m_editorFactory, SIGNAL(resetProperty(QtProperty*)), - SLOT(resetProperty(QtProperty*))); - connect(m_propertyManager, SIGNAL(valueChanged(QtProperty*,QVariant,bool)), - SLOT(propertyChanged(QtProperty*))); - connect(iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded())); + connect(m_editorFactory, &DesignerEditorFactory::resetProperty, + this, &AbstractItemEditor::resetProperty); + connect(m_propertyManager, &DesignerPropertyManager::valueChanged, + this, &AbstractItemEditor::propertyChanged); + connect(iconCache(), &DesignerIconCache::reloaded, this, &AbstractItemEditor::cacheReloaded); } AbstractItemEditor::~AbstractItemEditor() @@ -285,8 +285,8 @@ ItemListEditor::ItemListEditor(QDesignerFormWindowInterface *form, QWidget *pare ui.setupUi(this); injectPropertyBrowser(this, ui.widget); - connect(ui.showPropertiesButton, SIGNAL(clicked()), - this, SLOT(togglePropertyBrowser())); + connect(ui.showPropertiesButton, &QAbstractButton::clicked, + this, &ItemListEditor::togglePropertyBrowser); setPropertyBrowserVisible(false); QIcon upIcon = createIconSet(QString::fromUtf8("up.png")); @@ -298,7 +298,7 @@ ItemListEditor::ItemListEditor(QDesignerFormWindowInterface *form, QWidget *pare ui.newListItemButton->setIcon(plusIcon); ui.deleteListItemButton->setIcon(minusIcon); - connect(iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded())); + connect(iconCache(), &DesignerIconCache::reloaded, this, &AbstractItemEditor::cacheReloaded); } void ItemListEditor::setupEditor(QWidget *object, PropertyDefinition *propList) diff --git a/src/designer/src/components/taskmenu/itemlisteditor.h b/src/designer/src/components/taskmenu/itemlisteditor.h index 73f3f230..38564c89 100644 --- a/src/designer/src/components/taskmenu/itemlisteditor.h +++ b/src/designer/src/components/taskmenu/itemlisteditor.h @@ -82,10 +82,12 @@ public: const char *name; }; +public slots: + void cacheReloaded(); + private slots: void propertyChanged(QtProperty *property); void resetProperty(QtProperty *property); - void cacheReloaded(); protected: void setupProperties(PropertyDefinition *propDefs); diff --git a/src/designer/src/components/taskmenu/label_taskmenu.cpp b/src/designer/src/components/taskmenu/label_taskmenu.cpp index ed50fed2..bb39f9f0 100644 --- a/src/designer/src/components/taskmenu/label_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/label_taskmenu.cpp @@ -78,10 +78,10 @@ LabelTaskMenu::LabelTaskMenu(QLabel *label, QObject *parent) m_editPlainTextAction(new QAction(tr("Change plain text..."), this)) { LabelTaskMenuInlineEditor *editor = new LabelTaskMenuInlineEditor(label, this); - connect(m_editPlainTextAction, SIGNAL(triggered()), editor, SLOT(editText())); + connect(m_editPlainTextAction, &QAction::triggered, editor, &LabelTaskMenuInlineEditor::editText); m_taskActions.append(m_editPlainTextAction); - connect(m_editRichTextAction, SIGNAL(triggered()), this, SLOT(editRichText())); + connect(m_editRichTextAction, &QAction::triggered, this, &LabelTaskMenu::editRichText); m_taskActions.append(m_editRichTextAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp b/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp index d8403e38..96540711 100644 --- a/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp @@ -72,7 +72,7 @@ LineEditTaskMenu::LineEditTaskMenu(QLineEdit *lineEdit, QObject *parent) : m_editTextAction(new QAction(tr("Change text..."), this)) { TaskMenuInlineEditor *editor = new LineEditTaskMenuInlineEditor(lineEdit, this); - connect(m_editTextAction, SIGNAL(triggered()), editor, SLOT(editText())); + connect(m_editTextAction, &QAction::triggered, editor, &LineEditTaskMenuInlineEditor::editText); m_taskActions.append(m_editTextAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp index 3e2e8d2b..592f113d 100644 --- a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp @@ -57,7 +57,7 @@ ListWidgetTaskMenu::ListWidgetTaskMenu(QListWidget *button, QObject *parent) { m_editItemsAction = new QAction(this); m_editItemsAction->setText(tr("Edit Items...")); - connect(m_editItemsAction, SIGNAL(triggered()), this, SLOT(editItems())); + connect(m_editItemsAction, &QAction::triggered, this, &ListWidgetTaskMenu::editItems); m_taskActions.append(m_editItemsAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/listwidgeteditor.cpp b/src/designer/src/components/taskmenu/listwidgeteditor.cpp index 6c59ab17..26058277 100644 --- a/src/designer/src/components/taskmenu/listwidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/listwidgeteditor.cpp @@ -53,8 +53,8 @@ ListWidgetEditor::ListWidgetEditor(QDesignerFormWindowInterface *form, setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QDialogButtonBox *buttonBox = new QDialogButtonBox; buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); - connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); m_itemsEditor = new ItemListEditor(form, 0); m_itemsEditor->layout()->setMargin(0); diff --git a/src/designer/src/components/taskmenu/menutaskmenu.cpp b/src/designer/src/components/taskmenu/menutaskmenu.cpp index 9f652c5e..701f55ae 100644 --- a/src/designer/src/components/taskmenu/menutaskmenu.cpp +++ b/src/designer/src/components/taskmenu/menutaskmenu.cpp @@ -48,7 +48,7 @@ namespace qdesigner_internal { m_removeAction(new QAction(tr("Remove"), this)), m_promotionTaskMenu(new PromotionTaskMenu(menu, PromotionTaskMenu::ModeSingleWidget, this)) { - connect(m_removeAction, SIGNAL(triggered()), this, SLOT(removeMenu())); + connect(m_removeAction, &QAction::triggered, this, &MenuTaskMenu::removeMenu); } QAction *MenuTaskMenu::preferredEditAction() const diff --git a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp index 490d14ba..77e4ad35 100644 --- a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp @@ -55,7 +55,7 @@ TableWidgetTaskMenu::TableWidgetTaskMenu(QTableWidget *button, QObject *parent) m_tableWidget(button), m_editItemsAction(new QAction(tr("Edit Items..."), this)) { - connect(m_editItemsAction, SIGNAL(triggered()), this, SLOT(editItems())); + connect(m_editItemsAction, &QAction::triggered, this, &TableWidgetTaskMenu::editItems); m_taskActions.append(m_editItemsAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp index 78964856..697b5a9e 100644 --- a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp @@ -63,8 +63,8 @@ TableWidgetEditor::TableWidgetEditor(QDesignerFormWindowInterface *form, QDialog ui.setupUi(dialog); injectPropertyBrowser(ui.itemsTab, ui.widget); - connect(ui.showPropertiesButton, SIGNAL(clicked()), - this, SLOT(togglePropertyBrowser())); + connect(ui.showPropertiesButton, &QAbstractButton::clicked, + this, &TableWidgetEditor::togglePropertyBrowser); setPropertyBrowserVisible(false); ui.tabWidget->insertTab(0, m_columnEditor, tr("&Columns")); @@ -74,37 +74,37 @@ TableWidgetEditor::TableWidgetEditor(QDesignerFormWindowInterface *form, QDialog ui.tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); - connect(iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded())); - - connect(ui.tableWidget, SIGNAL(currentCellChanged(int,int,int,int)), - this, SLOT(on_tableWidget_currentCellChanged(int,int,int,int))); - connect(ui.tableWidget, SIGNAL(itemChanged(QTableWidgetItem*)), - this, SLOT(on_tableWidget_itemChanged(QTableWidgetItem*))); - connect(m_columnEditor, SIGNAL(indexChanged(int)), - this, SLOT(on_columnEditor_indexChanged(int))); - connect(m_columnEditor, SIGNAL(itemChanged(int,int,QVariant)), - this, SLOT(on_columnEditor_itemChanged(int,int,QVariant))); - connect(m_columnEditor, SIGNAL(itemInserted(int)), - this, SLOT(on_columnEditor_itemInserted(int))); - connect(m_columnEditor, SIGNAL(itemDeleted(int)), - this, SLOT(on_columnEditor_itemDeleted(int))); - connect(m_columnEditor, SIGNAL(itemMovedUp(int)), - this, SLOT(on_columnEditor_itemMovedUp(int))); - connect(m_columnEditor, SIGNAL(itemMovedDown(int)), - this, SLOT(on_columnEditor_itemMovedDown(int))); - - connect(m_rowEditor, SIGNAL(indexChanged(int)), - this, SLOT(on_rowEditor_indexChanged(int))); - connect(m_rowEditor, SIGNAL(itemChanged(int,int,QVariant)), - this, SLOT(on_rowEditor_itemChanged(int,int,QVariant))); - connect(m_rowEditor, SIGNAL(itemInserted(int)), - this, SLOT(on_rowEditor_itemInserted(int))); - connect(m_rowEditor, SIGNAL(itemDeleted(int)), - this, SLOT(on_rowEditor_itemDeleted(int))); - connect(m_rowEditor, SIGNAL(itemMovedUp(int)), - this, SLOT(on_rowEditor_itemMovedUp(int))); - connect(m_rowEditor, SIGNAL(itemMovedDown(int)), - this, SLOT(on_rowEditor_itemMovedDown(int))); + connect(iconCache(), &DesignerIconCache::reloaded, this, &TableWidgetEditor::cacheReloaded); + + connect(ui.tableWidget, &QTableWidget::currentCellChanged, + this, &TableWidgetEditor::on_tableWidget_currentCellChanged); + connect(ui.tableWidget, &QTableWidget::itemChanged, + this, &TableWidgetEditor::on_tableWidget_itemChanged); + connect(m_columnEditor, &ItemListEditor::indexChanged, + this, &TableWidgetEditor::on_columnEditor_indexChanged); + connect(m_columnEditor, &ItemListEditor::itemChanged, + this, &TableWidgetEditor::on_columnEditor_itemChanged); + connect(m_columnEditor, &ItemListEditor::itemInserted, + this, &TableWidgetEditor::on_columnEditor_itemInserted); + connect(m_columnEditor, &ItemListEditor::itemDeleted, + this, &TableWidgetEditor::on_columnEditor_itemDeleted); + connect(m_columnEditor, &ItemListEditor::itemMovedUp, + this, &TableWidgetEditor::on_columnEditor_itemMovedUp); + connect(m_columnEditor, &ItemListEditor::itemMovedDown, + this, &TableWidgetEditor::on_columnEditor_itemMovedDown); + + connect(m_rowEditor, &ItemListEditor::indexChanged, + this, &TableWidgetEditor::on_rowEditor_indexChanged); + connect(m_rowEditor, &ItemListEditor::itemChanged, + this, &TableWidgetEditor::on_rowEditor_itemChanged); + connect(m_rowEditor, &ItemListEditor::itemInserted, + this, &TableWidgetEditor::on_rowEditor_itemInserted); + connect(m_rowEditor, &ItemListEditor::itemDeleted, + this, &TableWidgetEditor::on_rowEditor_itemDeleted); + connect(m_rowEditor, &ItemListEditor::itemMovedUp, + this, &TableWidgetEditor::on_rowEditor_itemMovedUp); + connect(m_rowEditor, &ItemListEditor::itemMovedDown, + this, &TableWidgetEditor::on_rowEditor_itemMovedDown); } static AbstractItemEditor::PropertyDefinition tableHeaderPropList[] = { diff --git a/src/designer/src/components/taskmenu/textedit_taskmenu.cpp b/src/designer/src/components/taskmenu/textedit_taskmenu.cpp index 3ff63972..12e9d20a 100644 --- a/src/designer/src/components/taskmenu/textedit_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/textedit_taskmenu.cpp @@ -66,7 +66,7 @@ TextEditTaskMenu::TextEditTaskMenu(QPlainTextEdit *textEdit, QObject *parent) : void TextEditTaskMenu::initialize() { - connect(m_editTextAction, SIGNAL(triggered()), this, SLOT(editText())); + connect(m_editTextAction, &QAction::triggered, this, &TextEditTaskMenu::editText); m_taskActions.append(m_editTextAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp b/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp index 7b3d5e7a..35f58729 100644 --- a/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp @@ -73,7 +73,7 @@ namespace qdesigner_internal { m_removeAction(new QAction(tr("Remove"), this)), m_promotionTaskMenu(new PromotionTaskMenu(sb, PromotionTaskMenu::ModeSingleWidget, this)) { - connect(m_removeAction, SIGNAL(triggered()), this, SLOT(removeStatusBar())); + connect(m_removeAction, &QAction::triggered, this, &StatusBarTaskMenu::removeStatusBar); } QAction *StatusBarTaskMenu::preferredEditAction() const diff --git a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp index c781d1d0..4e0cb790 100644 --- a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp @@ -54,7 +54,7 @@ TreeWidgetTaskMenu::TreeWidgetTaskMenu(QTreeWidget *button, QObject *parent) m_treeWidget(button), m_editItemsAction(new QAction(tr("Edit Items..."), this)) { - connect(m_editItemsAction, SIGNAL(triggered()), this, SLOT(editItems())); + connect(m_editItemsAction, &QAction::triggered, this, &TreeWidgetTaskMenu::editItems); m_taskActions.append(m_editItemsAction); QAction *sep = new QAction(this); diff --git a/src/designer/src/components/taskmenu/treewidgeteditor.cpp b/src/designer/src/components/taskmenu/treewidgeteditor.cpp index cd30dddb..05cb05ba 100644 --- a/src/designer/src/components/taskmenu/treewidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/treewidgeteditor.cpp @@ -61,8 +61,8 @@ TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QDialog * ui.setupUi(dialog); injectPropertyBrowser(ui.itemsTab, ui.widget); - connect(ui.showPropertiesButton, SIGNAL(clicked()), - this, SLOT(togglePropertyBrowser())); + connect(ui.showPropertiesButton, &QAbstractButton::clicked, + this, &TreeWidgetEditor::togglePropertyBrowser); setPropertyBrowserVisible(false); ui.tabWidget->insertTab(0, m_columnEditor, tr("&Columns")); @@ -79,32 +79,32 @@ TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QDialog * ui.treeWidget->header()->setSectionsMovable(false); - connect(ui.newItemButton, SIGNAL(clicked()), this, SLOT(on_newItemButton_clicked())); - connect(ui.newSubItemButton, SIGNAL(clicked()), this, SLOT(on_newSubItemButton_clicked())); - connect(ui.moveItemUpButton, SIGNAL(clicked()), this, SLOT(on_moveItemUpButton_clicked())); - connect(ui.moveItemDownButton, SIGNAL(clicked()), this, SLOT(on_moveItemDownButton_clicked())); - connect(ui.moveItemRightButton, SIGNAL(clicked()), this, SLOT(on_moveItemRightButton_clicked())); - connect(ui.moveItemLeftButton, SIGNAL(clicked()), this, SLOT(on_moveItemLeftButton_clicked())); - connect(ui.deleteItemButton, SIGNAL(clicked()), this, SLOT(on_deleteItemButton_clicked())); - connect(ui.treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), - this, SLOT(on_treeWidget_currentItemChanged())); - connect(ui.treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), - this, SLOT(on_treeWidget_itemChanged(QTreeWidgetItem*,int))); - - connect(m_columnEditor, SIGNAL(indexChanged(int)), - this, SLOT(on_columnEditor_indexChanged(int))); - connect(m_columnEditor, SIGNAL(itemChanged(int,int,QVariant)), - this, SLOT(on_columnEditor_itemChanged(int,int,QVariant))); - connect(m_columnEditor, SIGNAL(itemInserted(int)), - this, SLOT(on_columnEditor_itemInserted(int))); - connect(m_columnEditor, SIGNAL(itemDeleted(int)), - this, SLOT(on_columnEditor_itemDeleted(int))); - connect(m_columnEditor, SIGNAL(itemMovedUp(int)), - this, SLOT(on_columnEditor_itemMovedUp(int))); - connect(m_columnEditor, SIGNAL(itemMovedDown(int)), - this, SLOT(on_columnEditor_itemMovedDown(int))); - - connect(iconCache(), SIGNAL(reloaded()), this, SLOT(cacheReloaded())); + connect(ui.newItemButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_newItemButton_clicked); + connect(ui.newSubItemButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_newSubItemButton_clicked); + connect(ui.moveItemUpButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemUpButton_clicked); + connect(ui.moveItemDownButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemDownButton_clicked); + connect(ui.moveItemRightButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemRightButton_clicked); + connect(ui.moveItemLeftButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemLeftButton_clicked); + connect(ui.deleteItemButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_deleteItemButton_clicked); + connect(ui.treeWidget, &QTreeWidget::currentItemChanged, + this, &TreeWidgetEditor::on_treeWidget_currentItemChanged); + connect(ui.treeWidget, &QTreeWidget::itemChanged, + this, &TreeWidgetEditor::on_treeWidget_itemChanged); + + connect(m_columnEditor, &ItemListEditor::indexChanged, + this, &TreeWidgetEditor::on_columnEditor_indexChanged); + connect(m_columnEditor, &ItemListEditor::itemChanged, + this, &TreeWidgetEditor::on_columnEditor_itemChanged); + connect(m_columnEditor, &ItemListEditor::itemInserted, + this, &TreeWidgetEditor::on_columnEditor_itemInserted); + connect(m_columnEditor, &ItemListEditor::itemDeleted, + this, &TreeWidgetEditor::on_columnEditor_itemDeleted); + connect(m_columnEditor, &ItemListEditor::itemMovedUp, + this, &TreeWidgetEditor::on_columnEditor_itemMovedUp); + connect(m_columnEditor, &ItemListEditor::itemMovedDown, + this, &TreeWidgetEditor::on_columnEditor_itemMovedDown); + + connect(iconCache(), &DesignerIconCache::reloaded, this, &TreeWidgetEditor::cacheReloaded); } static AbstractItemEditor::PropertyDefinition treeHeaderPropList[] = { diff --git a/src/designer/src/components/widgetbox/widgetbox.cpp b/src/designer/src/components/widgetbox/widgetbox.cpp index 5ed22b71..f7287834 100644 --- a/src/designer/src/components/widgetbox/widgetbox.cpp +++ b/src/designer/src/components/widgetbox/widgetbox.cpp @@ -110,13 +110,13 @@ WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::Wi QLineEdit *filterWidget = new WidgetBoxFilterLineEdit(toolBar); filterWidget->setPlaceholderText(tr("Filter")); filterWidget->setClearButtonEnabled(true); - connect(filterWidget, SIGNAL(textChanged(QString)), m_view, SLOT(filter(QString))); + connect(filterWidget, &QLineEdit::textChanged, m_view, &WidgetBoxTreeWidget::filter); toolBar->addWidget(filterWidget); l->addWidget(toolBar); // View - connect(m_view, SIGNAL(pressed(QString,QString,QPoint)), - this, SLOT(handleMousePress(QString,QString,QPoint))); + connect(m_view, &WidgetBoxTreeWidget::pressed, + this, &WidgetBox::handleMousePress); l->addWidget(m_view); setAcceptDrops (true); diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp index db04cfbc..1d586cd9 100644 --- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp +++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp @@ -382,13 +382,15 @@ WidgetBoxCategoryListView::WidgetBoxCategoryListView(QDesignerFormEditorInterfac setItemDelegate(new WidgetBoxCategoryEntryDelegate(this)); - connect(this, SIGNAL(pressed(QModelIndex)), this, SLOT(slotPressed(QModelIndex))); + connect(this, &QListView::pressed, this, + &WidgetBoxCategoryListView::slotPressed); setEditTriggers(QAbstractItemView::AnyKeyPressed); m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterRole(FilterRole); setModel(m_proxyModel); - connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(scratchPadChanged())); + connect(m_model, &QAbstractItemModel::dataChanged, + this, &WidgetBoxCategoryListView::scratchPadChanged); } void WidgetBoxCategoryListView::setViewMode(ViewMode vm) diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.h b/src/designer/src/components/widgetbox/widgetboxcategorylistview.h index 07987e60..5f798332 100644 --- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.h +++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.h @@ -91,11 +91,11 @@ signals: public slots: void filter(const QRegExp &re); + void removeCurrentItem(); + void editCurrentItem(); private slots: void slotPressed(const QModelIndex &index); - void removeCurrentItem(); - void editCurrentItem(); private: int mapRowToSource(int filterRow) const; diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp index 116cef29..9f82dec5 100644 --- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp +++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp @@ -108,8 +108,8 @@ WidgetBoxTreeWidget::WidgetBoxTreeWidget(QDesignerFormEditorInterface *core, QWi setItemDelegate(new SheetDelegate(this, this)); - connect(this, SIGNAL(itemPressed(QTreeWidgetItem*,int)), - this, SLOT(handleMousePress(QTreeWidgetItem*))); + connect(this, &QTreeWidget::itemPressed, + this, &WidgetBoxTreeWidget::handleMousePress); } QIcon WidgetBoxTreeWidget::iconForWidget(QString iconName) const @@ -254,10 +254,14 @@ WidgetBoxCategoryListView *WidgetBoxTreeWidget::addCategoryView(QTreeWidgetItem embed_item->setFlags(Qt::ItemIsEnabled); WidgetBoxCategoryListView *categoryView = new WidgetBoxCategoryListView(m_core, this); categoryView->setViewMode(iconMode ? QListView::IconMode : QListView::ListMode); - connect(categoryView, SIGNAL(scratchPadChanged()), this, SLOT(slotSave())); - connect(categoryView, SIGNAL(pressed(QString,QString,QPoint)), this, SIGNAL(pressed(QString,QString,QPoint))); - connect(categoryView, SIGNAL(itemRemoved()), this, SLOT(slotScratchPadItemDeleted())); - connect(categoryView, SIGNAL(lastItemRemoved()), this, SLOT(slotLastScratchPadItemDeleted())); + connect(categoryView, &WidgetBoxCategoryListView::scratchPadChanged, + this, &WidgetBoxTreeWidget::slotSave); + connect(categoryView, &WidgetBoxCategoryListView::pressed, + this, &WidgetBoxTreeWidget::pressed); + connect(categoryView, &WidgetBoxCategoryListView::itemRemoved, + this, &WidgetBoxTreeWidget::slotScratchPadItemDeleted); + connect(categoryView, &WidgetBoxCategoryListView::lastItemRemoved, + this, &WidgetBoxTreeWidget::slotLastScratchPadItemDeleted); setItemWidget(embed_item, 0, categoryView); return categoryView; } @@ -811,7 +815,8 @@ void WidgetBoxTreeWidget::slotLastScratchPadItemDeleted() m_scratchPadDeleteTimer = new QTimer(this); m_scratchPadDeleteTimer->setSingleShot(true); m_scratchPadDeleteTimer->setInterval(0); - connect(m_scratchPadDeleteTimer, SIGNAL(timeout()), this, SLOT(deleteScratchpad())); + connect(m_scratchPadDeleteTimer, &QTimer::timeout, + this, &WidgetBoxTreeWidget::deleteScratchpad); } if (!m_scratchPadDeleteTimer->isActive()) m_scratchPadDeleteTimer->start(); @@ -875,8 +880,8 @@ void WidgetBoxTreeWidget::contextMenuEvent(QContextMenuEvent *e) && topLevelRole(item->parent()) == SCRATCHPAD_ITEM; QMenu menu; - menu.addAction(tr("Expand all"), this, SLOT(expandAll())); - menu.addAction(tr("Collapse all"), this, SLOT(collapseAll())); + menu.addAction(tr("Expand all"), this, &WidgetBoxTreeWidget::expandAll); + menu.addAction(tr("Collapse all"), this, &WidgetBoxTreeWidget::collapseAll); menu.addSeparator(); QAction *listModeAction = menu.addAction(tr("List View")); @@ -890,14 +895,16 @@ void WidgetBoxTreeWidget::contextMenuEvent(QContextMenuEvent *e) iconModeAction->setChecked(true); else listModeAction->setChecked(true); - connect(listModeAction, SIGNAL(triggered()), SLOT(slotListMode())); - connect(iconModeAction, SIGNAL(triggered()), SLOT(slotIconMode())); + connect(listModeAction, &QAction::triggered, this, &WidgetBoxTreeWidget::slotListMode); + connect(iconModeAction, &QAction::triggered, this, &WidgetBoxTreeWidget::slotIconMode); if (scratchpad_menu) { menu.addSeparator(); - menu.addAction(tr("Remove"), itemWidget(item, 0), SLOT(removeCurrentItem())); + WidgetBoxCategoryListView *listView = qobject_cast<WidgetBoxCategoryListView *>(itemWidget(item, 0)); + Q_ASSERT(listView); + menu.addAction(tr("Remove"), listView, &WidgetBoxCategoryListView::removeCurrentItem); if (!m_iconMode) - menu.addAction(tr("Edit name"), itemWidget(item, 0), SLOT(editCurrentItem())); + menu.addAction(tr("Edit name"), listView, &WidgetBoxCategoryListView::editCurrentItem); } e->accept(); menu.exec(mapToGlobal(e->pos())); diff --git a/src/designer/src/designer/appfontdialog.cpp b/src/designer/src/designer/appfontdialog.cpp index e6be5a4a..e9c379d0 100644 --- a/src/designer/src/designer/appfontdialog.cpp +++ b/src/designer/src/designer/appfontdialog.cpp @@ -285,20 +285,20 @@ AppFontWidget::AppFontWidget(QWidget *parent) : m_view->setModel(m_model); m_view->setSelectionMode(QAbstractItemView::ExtendedSelection); m_view->expandAll(); - connect(m_view->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged(QItemSelection,QItemSelection))); + connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &AppFontWidget::selectionChanged); m_addButton->setToolTip(tr("Add font files")); m_addButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("plus.png"))); - connect(m_addButton, SIGNAL(clicked()), this, SLOT(addFiles())); + connect(m_addButton, &QAbstractButton::clicked, this, &AppFontWidget::addFiles); m_removeButton->setEnabled(false); m_removeButton->setToolTip(tr("Remove current font file")); m_removeButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("minus.png"))); - connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveFiles())); + connect(m_removeButton, &QAbstractButton::clicked, this, &AppFontWidget::slotRemoveFiles); m_removeAllButton->setToolTip(tr("Remove all font files")); m_removeAllButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("editdelete.png"))); - connect(m_removeAllButton, SIGNAL(clicked()), this, SLOT(slotRemoveAll())); + connect(m_removeAllButton, &QAbstractButton::clicked, this, &AppFontWidget::slotRemoveAll); QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addWidget(m_addButton); @@ -414,7 +414,7 @@ AppFontDialog::AppFontDialog(QWidget *parent) : vl->addWidget(m_appFontWidget); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close); - QDialog::connect(bb, SIGNAL(rejected()), this, SLOT(reject())); + QDialog::connect(bb, &QDialogButtonBox::rejected, this, &AppFontDialog::reject); vl->addWidget(bb); setLayout(vl); } diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp index 8debba76..02e4c3d3 100644 --- a/src/designer/src/designer/mainwindow.cpp +++ b/src/designer/src/designer/mainwindow.cpp @@ -223,7 +223,7 @@ ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow, { m_configureAction->setMenuRole(QAction::NoRole); m_configureAction->setObjectName(QStringLiteral("__qt_configure_tool_bars_action")); - connect(m_configureAction, SIGNAL(triggered()), this, SLOT(configureToolBars())); + connect(m_configureAction, &QAction::triggered, this, &ToolBarManager::configureToolBars); m_manager->setMainWindow(configureableMainWindow); @@ -320,10 +320,10 @@ DockedMainWindow::DockedMainWindow(QDesignerWorkbench *wb, foreach (QToolBar *tb, toolbars) addToolBar(tb); DockedMdiArea *dma = new DockedMdiArea(wb->actionManager()->uiExtension()); - connect(dma, SIGNAL(fileDropped(QString)), - this, SIGNAL(fileDropped(QString))); - connect(dma, SIGNAL(subWindowActivated(QMdiSubWindow*)), - this, SLOT(slotSubWindowActivated(QMdiSubWindow*))); + connect(dma, &DockedMdiArea::fileDropped, + this, &DockedMainWindow::fileDropped); + connect(dma, &QMdiArea::subWindowActivated, + this, &DockedMainWindow::slotSubWindowActivated); setCentralWidget(dma); QStatusBar *sb = statusBar(); diff --git a/src/designer/src/designer/newform.cpp b/src/designer/src/designer/newform.cpp index ada948c2..f55726c8 100644 --- a/src/designer/src/designer/newform.cpp +++ b/src/designer/src/designer/newform.cpp @@ -73,8 +73,10 @@ NewForm::NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget, const QSt QVBoxLayout *vBoxLayout = new QVBoxLayout; - connect(m_newFormWidget, SIGNAL(templateActivated()), this, SLOT(slotTemplateActivated())); - connect(m_newFormWidget, SIGNAL(currentTemplateChanged(bool)), this, SLOT(slotCurrentTemplateChanged(bool))); + connect(m_newFormWidget, &QDesignerNewFormWidgetInterface::templateActivated, + this, &NewForm::slotTemplateActivated); + connect(m_newFormWidget, &QDesignerNewFormWidgetInterface::currentTemplateChanged, + this, &NewForm::slotCurrentTemplateChanged); vBoxLayout->addWidget(m_newFormWidget); QFrame *horizontalLine = new QFrame; @@ -111,11 +113,11 @@ QDialogButtonBox *NewForm::createButtonBox() const QList<QAction *>::const_iterator acend = recentActions.constEnd(); for (QList<QAction *>::const_iterator it = recentActions.constBegin(); it != acend; ++it) { recentFilesMenu->addAction(*it); - connect(*it, SIGNAL(triggered()), this, SLOT(recentFileChosen())); + connect(*it, &QAction::triggered, this, &NewForm::recentFileChosen); } } m_recentButton->setMenu(recentFilesMenu); - connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonBoxClicked(QAbstractButton*))); + connect(buttonBox, &QDialogButtonBox::clicked, this, &NewForm::slotButtonBoxClicked); return buttonBox; } diff --git a/src/designer/src/designer/preferencesdialog.cpp b/src/designer/src/designer/preferencesdialog.cpp index 670e9e67..a34e899d 100644 --- a/src/designer/src/designer/preferencesdialog.cpp +++ b/src/designer/src/designer/preferencesdialog.cpp @@ -58,12 +58,13 @@ PreferencesDialog::PreferencesDialog(QDesignerFormEditorInterface *core, QWidget QWidget *page = optionsPage->createPage(this); m_ui->m_optionTabWidget->addTab(page, optionsPage->name()); if (QDesignerAppearanceOptionsWidget *appearanceWidget = qobject_cast<QDesignerAppearanceOptionsWidget *>(page)) - connect(appearanceWidget, SIGNAL(uiModeChanged(bool)), this, SLOT(slotUiModeChanged(bool))); + connect(appearanceWidget, &QDesignerAppearanceOptionsWidget::uiModeChanged, + this, &PreferencesDialog::slotUiModeChanged); } - connect(m_ui->m_dialogButtonBox, SIGNAL(rejected()), this, SLOT(slotRejected())); - connect(m_ui->m_dialogButtonBox, SIGNAL(accepted()), this, SLOT(slotAccepted())); - connect(applyButton(), SIGNAL(clicked()), this, SLOT(slotApply())); + connect(m_ui->m_dialogButtonBox, &QDialogButtonBox::rejected, this, &PreferencesDialog::slotRejected); + connect(m_ui->m_dialogButtonBox, &QDialogButtonBox::accepted, this, &PreferencesDialog::slotAccepted); + connect(applyButton(), &QAbstractButton::clicked, this, &PreferencesDialog::slotApply); } PreferencesDialog::~PreferencesDialog() diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp index 0f345ad6..5e6a3db9 100644 --- a/src/designer/src/designer/qdesigner.cpp +++ b/src/designer/src/designer/qdesigner.cpp @@ -282,7 +282,7 @@ QDesigner::ParseArgumentsResult QDesigner::parseCommandLineArguments() // Show up error box with parent now if something went wrong if (m_initializationErrors.isEmpty()) { if (!m_suppressNewFormShow && QDesignerSettings(m_workbench->core()).showNewFormOnStartup()) - QTimer::singleShot(100, this, SLOT(callCreateForm())); // won't show anything if suppressed + QTimer::singleShot(100, this, &QDesigner::callCreateForm); // won't show anything if suppressed } else { showErrorMessageBox(m_initializationErrors); m_initializationErrors.clear(); diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp index 22ffe120..242e7ec9 100644 --- a/src/designer/src/designer/qdesigner_actions.cpp +++ b/src/designer/src/designer/qdesigner_actions.cpp @@ -195,6 +195,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) #endif m_previewManager(0) { + typedef void (QDesignerActions::*VoidSlot)(); + #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) m_newFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-new"), m_newFormAction->icon())); m_openFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-open"), m_openFormAction->icon())); @@ -211,8 +213,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_previewManager = ifwm->previewManager(); m_previewFormAction = ifwm->action(QDesignerFormWindowManagerInterface::DefaultPreviewAction); m_styleActions = ifwm->actionGroup(QDesignerFormWindowManagerInterface::StyledPreviewActionGroup); - connect(ifwm, SIGNAL(formWindowSettingsChanged(QDesignerFormWindowInterface*)), - this, SLOT(formWindowSettingsChanged(QDesignerFormWindowInterface*))); + connect(ifwm, &QDesignerFormWindowManagerInterface::formWindowSettingsChanged, + this, &QDesignerActions::formWindowSettingsChanged); m_editWidgetsAction->setObjectName(QStringLiteral("__qt_edit_widgets_action")); m_newFormAction->setObjectName(QStringLiteral("__qt_new_form_action")); @@ -242,21 +244,21 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) // file actions // m_newFormAction->setShortcut(QKeySequence::New); - connect(m_newFormAction, SIGNAL(triggered()), this, SLOT(createForm())); + connect(m_newFormAction, &QAction::triggered, this, &QDesignerActions::createForm); m_fileActions->addAction(m_newFormAction); m_openFormAction->setShortcut(QKeySequence::Open); - connect(m_openFormAction, SIGNAL(triggered()), this, SLOT(slotOpenForm())); + connect(m_openFormAction, &QAction::triggered, this, &QDesignerActions::slotOpenForm); m_fileActions->addAction(m_openFormAction); m_fileActions->addAction(createRecentFilesMenu()); m_fileActions->addAction(createSeparator(this)); m_saveFormAction->setShortcut(QKeySequence::Save); - connect(m_saveFormAction, SIGNAL(triggered()), this, SLOT(saveForm())); + connect(m_saveFormAction, &QAction::triggered, this, static_cast<VoidSlot>(&QDesignerActions::saveForm)); m_fileActions->addAction(m_saveFormAction); - connect(m_saveFormAsAction, SIGNAL(triggered()), this, SLOT(saveFormAs())); + connect(m_saveFormAsAction, &QAction::triggered, this, static_cast<VoidSlot>(&QDesignerActions::saveFormAs)); m_fileActions->addAction(m_saveFormAsAction); #ifdef Q_OS_MAC @@ -264,26 +266,26 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) #else m_saveAllFormsAction->setShortcut(tr("CTRL+SHIFT+S")); // Commonly "Save As" on Mac #endif - connect(m_saveAllFormsAction, SIGNAL(triggered()), this, SLOT(saveAllForms())); + connect(m_saveAllFormsAction, &QAction::triggered, this, &QDesignerActions::saveAllForms); m_fileActions->addAction(m_saveAllFormsAction); - connect(m_saveFormAsTemplateAction, SIGNAL(triggered()), this, SLOT(saveFormAsTemplate())); + connect(m_saveFormAsTemplateAction, &QAction::triggered, this, &QDesignerActions::saveFormAsTemplate); m_fileActions->addAction(m_saveFormAsTemplateAction); m_fileActions->addAction(createSeparator(this)); m_printPreviewAction->setShortcut(QKeySequence::Print); - connect(m_printPreviewAction, SIGNAL(triggered()), this, SLOT(printPreviewImage())); + connect(m_printPreviewAction, &QAction::triggered, this, &QDesignerActions::printPreviewImage); m_fileActions->addAction(m_printPreviewAction); m_printPreviewAction->setObjectName(QStringLiteral("__qt_print_action")); - connect(m_savePreviewImageAction, SIGNAL(triggered()), this, SLOT(savePreviewImage())); + connect(m_savePreviewImageAction, &QAction::triggered, this, &QDesignerActions::savePreviewImage); m_savePreviewImageAction->setObjectName(QStringLiteral("__qt_saveimage_action")); m_fileActions->addAction(m_savePreviewImageAction); m_fileActions->addAction(createSeparator(this)); m_closeFormAction->setShortcut(QKeySequence::Close); - connect(m_closeFormAction, SIGNAL(triggered()), this, SLOT(closeForm())); + connect(m_closeFormAction, &QAction::triggered, this, &QDesignerActions::closeForm); m_fileActions->addAction(m_closeFormAction); updateCloseAction(); @@ -291,7 +293,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_quitAction->setShortcuts(QKeySequence::Quit); m_quitAction->setMenuRole(QAction::QuitRole); - connect(m_quitAction, SIGNAL(triggered()), this, SLOT(shutdown())); + connect(m_quitAction, &QAction::triggered, this, &QDesignerActions::shutdown); m_fileActions->addAction(m_quitAction); // @@ -337,14 +339,14 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_editWidgetsAction->setShortcuts(shortcuts); QIcon fallback(m_core->resourceLocation() + QStringLiteral("/widgettool.png")); m_editWidgetsAction->setIcon(QIcon::fromTheme("designer-edit-widget", fallback)); - connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(editWidgetsSlot())); + connect(m_editWidgetsAction, &QAction::triggered, this, &QDesignerActions::editWidgetsSlot); m_editWidgetsAction->setChecked(true); m_editWidgetsAction->setEnabled(false); m_editWidgetsAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true); m_toolActions->addAction(m_editWidgetsAction); - connect(formWindowManager, SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), - this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*))); + connect(formWindowManager, &QDesignerFormWindowManager::activeFormWindowChanged, + this, &QDesignerActions::activeFormWindowChanged); QList<QObject*> builtinPlugins = QPluginLoader::staticInstances(); builtinPlugins += m_core->pluginManager()->instances(); @@ -358,11 +360,11 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) } } - connect(m_preferencesAction, SIGNAL(triggered()), this, SLOT(showPreferencesDialog())); + connect(m_preferencesAction, &QAction::triggered, this, &QDesignerActions::showPreferencesDialog); m_preferencesAction->setMenuRole(QAction::PreferencesRole); m_settingsActions->addAction(m_preferencesAction); - connect(m_appFontAction, SIGNAL(triggered()), this, SLOT(showAppFontDialog())); + connect(m_appFontAction, &QAction::triggered, this, &QDesignerActions::showAppFontDialog); m_settingsActions->addAction(m_appFontAction); // // form actions @@ -390,10 +392,12 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_previewFormAction->setShortcut(tr("CTRL+R")); m_formActions->addAction(m_previewFormAction); - connect(m_previewManager, SIGNAL(firstPreviewOpened()), this, SLOT(updateCloseAction())); - connect(m_previewManager, SIGNAL(lastPreviewClosed()), this, SLOT(updateCloseAction())); + connect(m_previewManager, &qdesigner_internal::PreviewManager::firstPreviewOpened, + this, &QDesignerActions::updateCloseAction); + connect(m_previewManager, &qdesigner_internal::PreviewManager::lastPreviewClosed, + this, &QDesignerActions::updateCloseAction); - connect(m_viewCodeAction, SIGNAL(triggered()), this, SLOT(viewCode())); + connect(m_viewCodeAction, &QAction::triggered, this, &QDesignerActions::viewCode); // Preview code only in Cpp if (qt_extension<QDesignerLanguageExtension *>(m_core->extensionManager(), m_core) == 0) m_formActions->addAction(m_viewCodeAction); @@ -407,11 +411,11 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_minimizeAction->setEnabled(false); m_minimizeAction->setCheckable(true); m_minimizeAction->setShortcut(tr("CTRL+M")); - connect(m_minimizeAction, SIGNAL(triggered()), m_workbench, SLOT(toggleFormMinimizationState())); + connect(m_minimizeAction, &QAction::triggered, m_workbench, &QDesignerWorkbench::toggleFormMinimizationState); m_windowActions->addAction(m_minimizeAction); m_windowActions->addAction(m_bringAllToFrontSeparator); - connect(m_bringAllToFrontAction, SIGNAL(triggered()), m_workbench, SLOT(bringAllToFront())); + connect(m_bringAllToFrontAction, &QAction::triggered, m_workbench, &QDesignerWorkbench::bringAllToFront); m_windowActions->addAction(m_bringAllToFrontAction); m_windowActions->addAction(m_windowListSeparatorAction); @@ -424,11 +428,13 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) activeFormWindowChanged(core()->formWindowManager()->activeFormWindow()); m_backupTimer->start(180000); // 3min - connect(m_backupTimer, SIGNAL(timeout()), this, SLOT(backupForms())); + connect(m_backupTimer, &QTimer::timeout, this, &QDesignerActions::backupForms); // Enable application font action - connect(formWindowManager, SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)), this, SLOT(formWindowCountChanged())); - connect(formWindowManager, SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)), this, SLOT(formWindowCountChanged())); + connect(formWindowManager, &QDesignerFormWindowManagerInterface::formWindowAdded, + this, &QDesignerActions::formWindowCountChanged); + connect(formWindowManager, &QDesignerFormWindowManagerInterface::formWindowRemoved, + this, &QDesignerActions::formWindowCountChanged); formWindowCountChanged(); } @@ -439,7 +445,7 @@ QActionGroup *QDesignerActions::createHelpActions() #ifndef QT_JAMBI_BUILD QAction *mainHelpAction = new QAction(tr("Qt Designer &Help"), this); mainHelpAction->setObjectName(QStringLiteral("__qt_designer_help_action")); - connect(mainHelpAction, SIGNAL(triggered()), this, SLOT(showDesignerHelp())); + connect(mainHelpAction, &QAction::triggered, this, &QDesignerActions::showDesignerHelp); mainHelpAction->setShortcut(Qt::CTRL + Qt::Key_Question); helpActions->addAction(mainHelpAction); @@ -447,7 +453,7 @@ QActionGroup *QDesignerActions::createHelpActions() QAction *widgetHelp = new QAction(tr("Current Widget Help"), this); widgetHelp->setObjectName(QStringLiteral("__qt_current_widget_help_action")); widgetHelp->setShortcut(Qt::Key_F1); - connect(widgetHelp, SIGNAL(triggered()), this, SLOT(showWidgetSpecificHelp())); + connect(widgetHelp, &QAction::triggered, this, &QDesignerActions::showWidgetSpecificHelp); helpActions->addAction(widgetHelp); #endif @@ -456,19 +462,20 @@ QActionGroup *QDesignerActions::createHelpActions() QAction *aboutPluginsAction = new QAction(tr("About Plugins"), this); aboutPluginsAction->setObjectName(QStringLiteral("__qt_about_plugins_action")); aboutPluginsAction->setMenuRole(QAction::ApplicationSpecificRole); - connect(aboutPluginsAction, SIGNAL(triggered()), m_core->formWindowManager(), SLOT(showPluginDialog())); + connect(aboutPluginsAction, &QAction::triggered, + m_core->formWindowManager(), &QDesignerFormWindowManagerInterface::showPluginDialog); helpActions->addAction(aboutPluginsAction); QAction *aboutDesignerAction = new QAction(tr("About Qt Designer"), this); aboutDesignerAction->setMenuRole(QAction::AboutRole); aboutDesignerAction->setObjectName(QStringLiteral("__qt_about_designer_action")); - connect(aboutDesignerAction, SIGNAL(triggered()), this, SLOT(aboutDesigner())); + connect(aboutDesignerAction, &QAction::triggered, this, &QDesignerActions::aboutDesigner); helpActions->addAction(aboutDesignerAction); QAction *aboutQtAction = new QAction(tr("About Qt"), this); aboutQtAction->setMenuRole(QAction::AboutQtRole); aboutQtAction->setObjectName(QStringLiteral("__qt_about_qt_action")); - connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + connect(aboutQtAction, &QAction::triggered, qApp, &QApplication::aboutQt); helpActions->addAction(aboutQtAction); return helpActions; } @@ -497,7 +504,7 @@ QAction *QDesignerActions::createRecentFilesMenu() for (int i = 0; i < MaxRecentFiles; ++i) { act = new QAction(this); act->setVisible(false); - connect(act, SIGNAL(triggered()), this, SLOT(openRecentForm())); + connect(act, &QAction::triggered, this, &QDesignerActions::openRecentForm); m_recentFilesActions->addAction(act); menu->addAction(act); } @@ -505,7 +512,7 @@ QAction *QDesignerActions::createRecentFilesMenu() menu->addSeparator(); act = new QAction(QIcon::fromTheme("edit-clear"), tr("Clear &Menu"), this); act->setObjectName(QStringLiteral("__qt_action_clear_menu_")); - connect(act, SIGNAL(triggered()), this, SLOT(clearRecentFiles())); + connect(act, &QAction::triggered, this, &QDesignerActions::clearRecentFiles); m_recentFilesActions->addAction(act); menu->addAction(act); diff --git a/src/designer/src/designer/qdesigner_appearanceoptions.cpp b/src/designer/src/designer/qdesigner_appearanceoptions.cpp index 6765cdd2..633503f6 100644 --- a/src/designer/src/designer/qdesigner_appearanceoptions.cpp +++ b/src/designer/src/designer/qdesigner_appearanceoptions.cpp @@ -72,12 +72,14 @@ QDesignerAppearanceOptionsWidget::QDesignerAppearanceOptionsWidget(QWidget *pare m_ui(new Ui::AppearanceOptionsWidget), m_initialUIMode(NeutralMode) { + typedef void (QComboBox::*QComboIntSignal)(int); + m_ui->setupUi(this); m_ui->m_uiModeCombo->addItem(tr("Docked Window"), QVariant(DockedMode)); m_ui->m_uiModeCombo->addItem(tr("Multiple Top-Level Windows"), QVariant(TopLevelMode)); - connect(m_ui->m_uiModeCombo, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotUiModeComboChanged())); + connect(m_ui->m_uiModeCombo, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged), + this, &QDesignerAppearanceOptionsWidget::slotUiModeComboChanged); m_ui->m_fontPanel->setCheckable(true); m_ui->m_fontPanel->setTitle(tr("Toolwindow Font")); diff --git a/src/designer/src/designer/qdesigner_formwindow.cpp b/src/designer/src/designer/qdesigner_formwindow.cpp index 50b3b158..9d562a1f 100644 --- a/src/designer/src/designer/qdesigner_formwindow.cpp +++ b/src/designer/src/designer/qdesigner_formwindow.cpp @@ -83,8 +83,9 @@ QDesignerFormWindow::QDesignerFormWindow(QDesignerFormWindowInterface *editor, Q m_action->setCheckable(true); - connect(m_editor->commandHistory(), SIGNAL(indexChanged(int)), this, SLOT(updateChanged())); - connect(m_editor, SIGNAL(geometryChanged()), this, SLOT(geometryChanged())); + connect(m_editor->commandHistory(), &QUndoStack::indexChanged, this, &QDesignerFormWindow::updateChanged); + connect(m_editor.data(), &QDesignerFormWindowInterface::geometryChanged, + this, &QDesignerFormWindow::slotGeometryChanged); } QDesignerFormWindow::~QDesignerFormWindow() @@ -148,7 +149,8 @@ void QDesignerFormWindow::firstShow() if (!m_windowTitleInitialized) { m_windowTitleInitialized = true; if (m_editor) { - connect(m_editor, SIGNAL(fileNameChanged(QString)), this, SLOT(updateWindowTitle(QString))); + connect(m_editor.data(), &QDesignerFormWindowInterface::fileNameChanged, + this, &QDesignerFormWindow::updateWindowTitle); updateWindowTitle(m_editor->fileName()); updateChanged(); } @@ -190,7 +192,8 @@ void QDesignerFormWindow::updateWindowTitle(const QString &fileName) if (!m_windowTitleInitialized) { m_windowTitleInitialized = true; if (m_editor) - connect(m_editor, SIGNAL(fileNameChanged(QString)), this, SLOT(updateWindowTitle(QString))); + connect(m_editor.data(), &QDesignerFormWindowInterface::fileNameChanged, + this, &QDesignerFormWindow::updateWindowTitle); } QString fileNameTitle; @@ -261,7 +264,7 @@ void QDesignerFormWindow::resizeEvent(QResizeEvent *rev) QWidget::resizeEvent(rev); } -void QDesignerFormWindow::geometryChanged() +void QDesignerFormWindow::slotGeometryChanged() { // If the form window changes, re-update the geometry of the current widget in the property editor. // Note that in the case of layouts, non-maincontainer widgets must also be updated, diff --git a/src/designer/src/designer/qdesigner_formwindow.h b/src/designer/src/designer/qdesigner_formwindow.h index 35a15266..45e69c20 100644 --- a/src/designer/src/designer/qdesigner_formwindow.h +++ b/src/designer/src/designer/qdesigner_formwindow.h @@ -64,7 +64,7 @@ public slots: private slots: void updateWindowTitle(const QString &fileName); - void geometryChanged(); + void slotGeometryChanged(); signals: void minimizationStateChanged(QDesignerFormWindowInterface *formWindow, bool minimized); diff --git a/src/designer/src/designer/qdesigner_server.cpp b/src/designer/src/designer/qdesigner_server.cpp index c103e0f4..6c7b2c7a 100644 --- a/src/designer/src/designer/qdesigner_server.cpp +++ b/src/designer/src/designer/qdesigner_server.cpp @@ -55,8 +55,8 @@ QDesignerServer::QDesignerServer(QObject *parent) m_server->listen(QHostAddress::LocalHost, 0); if (m_server->isListening()) { - connect(m_server, SIGNAL(newConnection()), - this, SLOT(handleNewConnection())); + connect(m_server, &QTcpServer::newConnection, + this, &QDesignerServer::handleNewConnection); } } @@ -108,10 +108,10 @@ void QDesignerServer::handleNewConnection() // no need for more than one connection if (m_socket == 0) { m_socket = m_server->nextPendingConnection(); - connect(m_socket, SIGNAL(readyRead()), - this, SLOT(readFromClient())); - connect(m_socket, SIGNAL(disconnected()), - this, SLOT(socketClosed())); + connect(m_socket, &QTcpSocket::readyRead, + this, &QDesignerServer::readFromClient); + connect(m_socket, &QTcpSocket::disconnected, + this, &QDesignerServer::socketClosed); } } @@ -121,8 +121,8 @@ QDesignerClient::QDesignerClient(quint16 port, QObject *parent) { m_socket = new QTcpSocket(this); m_socket->connectToHost(QHostAddress::LocalHost, port); - connect(m_socket, SIGNAL(readyRead()), - this, SLOT(readFromSocket())); + connect(m_socket, &QTcpSocket::readyRead, + this, &QDesignerClient::readFromSocket); } diff --git a/src/designer/src/designer/qdesigner_toolwindow.cpp b/src/designer/src/designer/qdesigner_toolwindow.cpp index 601ce713..917ef57b 100644 --- a/src/designer/src/designer/qdesigner_toolwindow.cpp +++ b/src/designer/src/designer/qdesigner_toolwindow.cpp @@ -89,7 +89,7 @@ QDesignerToolWindow::QDesignerToolWindow(QDesignerWorkbench *workbench, m_action->setShortcutContext(Qt::ApplicationShortcut); m_action->setText(title); m_action->setCheckable(true); - connect(m_action, SIGNAL(triggered(bool)), this, SLOT(showMe(bool))); + connect(m_action, &QAction::triggered, this, &QDesignerToolWindow::showMe); } void QDesignerToolWindow::showMe(bool v) diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp index 2aafaf17..aa2de910 100644 --- a/src/designer/src/designer/qdesigner_workbench.cpp +++ b/src/designer/src/designer/qdesigner_workbench.cpp @@ -186,7 +186,8 @@ QDesignerWorkbench::QDesignerWorkbench() : m_actionManager = new QDesignerActions(this); // accesses plugin components m_windowActions->setExclusive(true); - connect(m_windowActions, SIGNAL(triggered(QAction*)), this, SLOT(formWindowActionTriggered(QAction*))); + connect(m_windowActions, &QActionGroup::triggered, + this, &QDesignerWorkbench::formWindowActionTriggered); // Build main menu bar addMenu(m_globalMenuBar, tr("&File"), m_actionManager->fileActions()->actions()); @@ -220,12 +221,15 @@ QDesignerWorkbench::QDesignerWorkbench() : viewActions->addAction(action); } // The widget box becomes the main window in top level mode - if (i == QDesignerToolWindow::WidgetBox) - connect(toolWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*))); + if (i == QDesignerToolWindow::WidgetBox) { + connect(toolWindow, &QDesignerToolWindow::closeEventReceived, + this, &QDesignerWorkbench::handleCloseEvent); + } } // Integration m_integration = new QDesignerIntegration(m_core, this); - connect(m_integration, SIGNAL(helpRequested(QString,QString)), m_actionManager, SLOT(helpRequested(QString,QString))); + connect(m_integration, &QDesignerIntegration::helpRequested, + m_actionManager, &QDesignerActions::helpRequested); // remaining view options (config toolbars) viewMenu->addSeparator(); @@ -233,13 +237,13 @@ QDesignerWorkbench::QDesignerWorkbench() : emit initialized(); - connect(m_core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), - this, SLOT(updateWindowMenu(QDesignerFormWindowInterface*))); + connect(m_core->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + this, &QDesignerWorkbench::updateWindowMenu); { // Add application specific options pages QDesignerAppearanceOptionsPage *appearanceOptions = new QDesignerAppearanceOptionsPage(m_core); - connect(appearanceOptions, SIGNAL(settingsChanged()), this, SLOT(notifyUISettingsChanged())); + connect(appearanceOptions, &QDesignerAppearanceOptionsPage::settingsChanged, this, &QDesignerWorkbench::notifyUISettingsChanged); QList<QDesignerOptionsPageInterface*> optionsPages = m_core->optionsPages(); optionsPages.push_front(appearanceOptions); m_core->setOptionsPages(optionsPages); @@ -313,8 +317,8 @@ void QDesignerWorkbench::addFormWindow(QDesignerFormWindow *formWindow) m_actionManager->minimizeAction()->setEnabled(true); m_actionManager->minimizeAction()->setChecked(false); - connect(formWindow, SIGNAL(minimizationStateChanged(QDesignerFormWindowInterface*,bool)), - this, SLOT(minimizationStateChanged(QDesignerFormWindowInterface*,bool))); + connect(formWindow, &QDesignerFormWindow::minimizationStateChanged, + this, &QDesignerWorkbench::minimizationStateChanged); m_actionManager->editWidgets()->trigger(); } @@ -417,9 +421,12 @@ void QDesignerWorkbench::switchToDockedMode() m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows); m_dockedMainWindow->setUnifiedTitleAndToolBarOnMac(true); m_dockedMainWindow->setCloseEventPolicy(MainWindowBase::EmitCloseEventSignal); - connect(m_dockedMainWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*))); - connect(m_dockedMainWindow, SIGNAL(fileDropped(QString)), this, SLOT(slotFileDropped(QString))); - connect(m_dockedMainWindow, SIGNAL(formWindowActivated(QDesignerFormWindow*)), this, SLOT(slotFormWindowActivated(QDesignerFormWindow*))); + connect(m_dockedMainWindow, &DockedMainWindow::closeEventReceived, + this, &QDesignerWorkbench::handleCloseEvent); + connect(m_dockedMainWindow, &DockedMainWindow::fileDropped, + this, &QDesignerWorkbench::slotFileDropped); + connect(m_dockedMainWindow, &DockedMainWindow::formWindowActivated, + this, &QDesignerWorkbench::slotFormWindowActivated); m_dockedMainWindow->restoreSettings(settings, m_dockedMainWindow->addToolWindows(m_toolWindows), desktopGeometry()); m_core->setTopLevel(m_dockedMainWindow); @@ -616,7 +623,7 @@ void QDesignerWorkbench::removeFormWindow(QDesignerFormWindow *formWindow) // Show up new form dialog unless closing if (loadOk && m_state == StateUp && QDesignerSettings(m_core).showNewFormOnStartup()) { - QTimer::singleShot(200, m_actionManager, SLOT(createForm())); + QTimer::singleShot(200, m_actionManager, &QDesignerActions::createForm); } } } @@ -1064,7 +1071,7 @@ void QDesignerWorkbench::applyUiSettings() { if (m_uiSettingsChanged) { m_uiSettingsChanged = false; - QTimer::singleShot(0, this, SLOT(restoreUISettings())); + QTimer::singleShot(0, this, &QDesignerWorkbench::restoreUISettings); } } diff --git a/src/designer/src/designer/saveformastemplate.cpp b/src/designer/src/designer/saveformastemplate.cpp index a45d94de..97500cf5 100644 --- a/src/designer/src/designer/saveformastemplate.cpp +++ b/src/designer/src/designer/saveformastemplate.cpp @@ -51,6 +51,8 @@ SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormEditorInterface *core, m_core(core), m_formWindow(formWindow) { + typedef void (QComboBox::*QComboIntSignal)(int); + ui.setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -63,9 +65,10 @@ SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormEditorInterface *core, ui.categoryCombo->addItems(paths); ui.categoryCombo->addItem(tr("Add path...")); m_addPathIndex = ui.categoryCombo->count() - 1; - connect(ui.templateNameEdit, SIGNAL(textChanged(QString)), - this, SLOT(updateOKButton(QString))); - connect(ui.categoryCombo, SIGNAL(activated(int)), this, SLOT(checkToAddPath(int))); + connect(ui.templateNameEdit, &QLineEdit::textChanged, + this, &SaveFormAsTemplate::updateOKButton); + connect(ui.categoryCombo, static_cast<QComboIntSignal>(&QComboBox::activated), + this, &SaveFormAsTemplate::checkToAddPath); } SaveFormAsTemplate::~SaveFormAsTemplate() diff --git a/src/designer/src/designer/versiondialog.cpp b/src/designer/src/designer/versiondialog.cpp index 4cdbbc29..b7564bf5 100644 --- a/src/designer/src/designer/versiondialog.cpp +++ b/src/designer/src/designer/versiondialog.cpp @@ -171,8 +171,8 @@ VersionDialog::VersionDialog(QWidget *parent) lbl->setOpenExternalLinks(true); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); - connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject())); - connect(label, SIGNAL(triggered()), this, SLOT(accept())); + connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject); + connect(label, &VersionLabel::triggered, this, &QDialog::accept); layout->addWidget(label, 0, 0, 1, 1); layout->addWidget(lbl, 0, 1, 4, 4); layout->addWidget(buttonBox, 4, 2, 1, 1); diff --git a/src/designer/src/lib/extension/default_extensionfactory.cpp b/src/designer/src/lib/extension/default_extensionfactory.cpp index 1c8fce66..92aa184b 100644 --- a/src/designer/src/lib/extension/default_extensionfactory.cpp +++ b/src/designer/src/lib/extension/default_extensionfactory.cpp @@ -112,13 +112,13 @@ QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const ExtensionMap::iterator it = m_extensions.find(key); if (it == m_extensions.end()) { if (QObject *ext = createExtension(object, iid, const_cast<QExtensionFactory*>(this))) { - connect(ext, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*))); + connect(ext, &QObject::destroyed, this, &QExtensionFactory::objectDestroyed); it = m_extensions.insert(key, ext); } } if (!m_extended.contains(object)) { - connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*))); + connect(object, &QObject::destroyed, this, &QExtensionFactory::objectDestroyed); m_extended.insert(object, true); } diff --git a/src/designer/src/lib/sdk/abstractintegration.cpp b/src/designer/src/lib/sdk/abstractintegration.cpp index 4c2d811d..05746c2b 100644 --- a/src/designer/src/lib/sdk/abstractintegration.cpp +++ b/src/designer/src/lib/sdk/abstractintegration.cpp @@ -337,6 +337,8 @@ QDesignerIntegrationPrivate::QDesignerIntegrationPrivate(QDesignerIntegration *q void QDesignerIntegrationPrivate::initialize() { + typedef void (QDesignerIntegration::*QDesignerIntegrationUpdatePropertySlot3)(const QString &, const QVariant &, bool); + // // integrate the `Form Editor component' // @@ -344,22 +346,24 @@ void QDesignerIntegrationPrivate::initialize() // Extensions QDesignerFormEditorInterface *core = q->core(); if (QDesignerPropertyEditor *designerPropertyEditor= qobject_cast<QDesignerPropertyEditor *>(core->propertyEditor())) { - QObject::connect(designerPropertyEditor, SIGNAL(propertyValueChanged(QString,QVariant,bool)), q, SLOT(updateProperty(QString,QVariant,bool))); - QObject::connect(designerPropertyEditor, SIGNAL(resetProperty(QString)), q, SLOT(resetProperty(QString))); - QObject::connect(designerPropertyEditor, SIGNAL(addDynamicProperty(QString,QVariant)), - q, SLOT(addDynamicProperty(QString,QVariant))); - QObject::connect(designerPropertyEditor, SIGNAL(removeDynamicProperty(QString)), - q, SLOT(removeDynamicProperty(QString))); + QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::propertyValueChanged, + q, static_cast<QDesignerIntegrationUpdatePropertySlot3>(&QDesignerIntegration::updateProperty)); + QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::resetProperty, + q, &QDesignerIntegration::resetProperty); + QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::addDynamicProperty, + q, &QDesignerIntegration::addDynamicProperty); + QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::removeDynamicProperty, + q, &QDesignerIntegration::removeDynamicProperty); } else { QObject::connect(core->propertyEditor(), SIGNAL(propertyChanged(QString,QVariant)), - q, SLOT(updatePropertyPrivate(QString,QVariant))); + q, SLOT(updatePropertyPrivate(QString,QVariant))); // ### fixme: VS Integration leftover? } - QObject::connect(core->formWindowManager(), SIGNAL(formWindowAdded(QDesignerFormWindowInterface*)), - q, SLOT(setupFormWindow(QDesignerFormWindowInterface*))); + QObject::connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowAdded, + q, &QDesignerIntegrationInterface::setupFormWindow); - QObject::connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), - q, SLOT(updateActiveFormWindow(QDesignerFormWindowInterface*))); + QObject::connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + q, &QDesignerIntegrationInterface::updateActiveFormWindow); m_gradientManager = new QtGradientManager(q); core->setGradientManager(m_gradientManager); @@ -472,7 +476,8 @@ void QDesignerIntegrationPrivate::removeDynamicProperty(const QString &name) void QDesignerIntegrationPrivate::setupFormWindow(QDesignerFormWindowInterface *formWindow) { - QObject::connect(formWindow, SIGNAL(selectionChanged()), q, SLOT(updateSelection())); + QObject::connect(formWindow, &QDesignerFormWindowInterface::selectionChanged, + q, &QDesignerIntegrationInterface::updateSelection); } void QDesignerIntegrationPrivate::updateSelection() @@ -734,7 +739,8 @@ void QDesignerIntegration::updateActiveFormWindow(QDesignerFormWindowInterface * void QDesignerIntegration::setupFormWindow(QDesignerFormWindowInterface *formWindow) { d->setupFormWindow(formWindow); - connect(formWindow, SIGNAL(selectionChanged()), this, SLOT(updateSelection())); + connect(formWindow, &QDesignerFormWindowInterface::selectionChanged, + this, &QDesignerIntegrationInterface::updateSelection); } void QDesignerIntegration::updateSelection() diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index 185e2af1..a12bec72 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -144,38 +144,38 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, QIcon documentNewIcon = QIcon::fromTheme(QStringLiteral("document-new"), createIconSet(QStringLiteral("filenew.png"))); m_actionNew->setIcon(documentNewIcon); m_actionNew->setEnabled(false); - connect(m_actionNew, SIGNAL(triggered()), this, SLOT(slotNewAction())); + connect(m_actionNew, &QAction::triggered, this, &ActionEditor::slotNewAction); toolbar->addAction(m_actionNew); - connect(m_actionSelectAll, SIGNAL(triggered()), m_actionView, SLOT(selectAll())); + connect(m_actionSelectAll, &QAction::triggered, m_actionView, &ActionView::selectAll); #ifndef QT_NO_CLIPBOARD m_actionCut->setEnabled(false); - connect(m_actionCut, SIGNAL(triggered()), this, SLOT(slotCut())); + connect(m_actionCut, &QAction::triggered, this, &ActionEditor::slotCut); QIcon editCutIcon = QIcon::fromTheme(QStringLiteral("edit-cut"), createIconSet(QStringLiteral("editcut.png"))); m_actionCut->setIcon(editCutIcon); m_actionCopy->setEnabled(false); - connect(m_actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy())); + connect(m_actionCopy, &QAction::triggered, this, &ActionEditor::slotCopy); QIcon editCopyIcon = QIcon::fromTheme(QStringLiteral("edit-copy"), createIconSet(QStringLiteral("editcopy.png"))); m_actionCopy->setIcon(editCopyIcon); toolbar->addAction(m_actionCopy); - connect(m_actionPaste, SIGNAL(triggered()), this, SLOT(slotPaste())); + connect(m_actionPaste, &QAction::triggered, this, &ActionEditor::slotPaste); QIcon editPasteIcon = QIcon::fromTheme(QStringLiteral("edit-paste"), createIconSet(QStringLiteral("editpaste.png"))); m_actionPaste->setIcon(editPasteIcon); toolbar->addAction(m_actionPaste); #endif m_actionEdit->setEnabled(false); - connect(m_actionEdit, SIGNAL(triggered()), this, SLOT(editCurrentAction())); + connect(m_actionEdit, &QAction::triggered, this, &ActionEditor::editCurrentAction); - connect(m_actionNavigateToSlot, SIGNAL(triggered()), this, SLOT(navigateToSlotCurrentAction())); + connect(m_actionNavigateToSlot, &QAction::triggered, this, &ActionEditor::navigateToSlotCurrentAction); QIcon editDeleteIcon = QIcon::fromTheme(QStringLiteral("edit-delete"), createIconSet(QStringLiteral("editdelete.png"))); m_actionDelete->setIcon(editDeleteIcon); m_actionDelete->setEnabled(false); - connect(m_actionDelete, SIGNAL(triggered()), this, SLOT(slotDelete())); + connect(m_actionDelete, &QAction::triggered, this, &ActionEditor::slotDelete); toolbar->addAction(m_actionDelete); // Toolbutton with menu containing action group for detailed/icon view. Steal the icons from the file dialog. @@ -183,7 +183,7 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, QMenu *configureMenu; toolbar->addWidget(createConfigureMenuButton(tr("Configure Action Editor"), &configureMenu)); - connect(m_viewModeGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotViewMode(QAction*))); + connect(m_viewModeGroup, &QActionGroup::triggered, this, &ActionEditor::slotViewMode); m_iconViewAction = m_viewModeGroup->addAction(tr("Icon View")); m_iconViewAction->setData(QVariant(ActionView::IconView)); m_iconViewAction->setCheckable(true); @@ -199,7 +199,7 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, m_filterWidget = new QWidget(toolbar); QHBoxLayout *filterLayout = new QHBoxLayout(m_filterWidget); QLineEdit *filterLineEdit = new QLineEdit(m_filterWidget); - connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); + connect(filterLineEdit, &QLineEdit::textChanged, this, &ActionEditor::setFilter); filterLineEdit->setPlaceholderText(tr("Filter")); filterLineEdit->setClearButtonEnabled(true); filterLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored)); @@ -226,20 +226,20 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, m_actionGroups->setWrapping(false); #endif - connect(m_actionView, SIGNAL(resourceImageDropped(QString,QAction*)), - this, SLOT(resourceImageDropped(QString,QAction*))); + connect(m_actionView, &ActionView::resourceImageDropped, + this, &ActionEditor::resourceImageDropped); - connect(m_actionView, SIGNAL(currentChanged(QAction*)),this, SLOT(slotCurrentItemChanged(QAction*))); + connect(m_actionView, &ActionView::currentChanged,this, &ActionEditor::slotCurrentItemChanged); // make it possible for vs integration to reimplement edit action dialog - connect(m_actionView, SIGNAL(activated(QAction*)), this, SIGNAL(itemActivated(QAction*))); + connect(m_actionView, &ActionView::activated, this, &ActionEditor::itemActivated); - connect(m_actionView,SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(slotSelectionChanged(QItemSelection,QItemSelection))); + connect(m_actionView, &ActionView::selectionChanged, + this, &ActionEditor::slotSelectionChanged); - connect(m_actionView, SIGNAL(contextMenuRequested(QContextMenuEvent*,QAction*)), - this, SLOT(slotContextMenuRequested(QContextMenuEvent*,QAction*))); + connect(m_actionView, &ActionView::contextMenuRequested, + this, &ActionEditor::slotContextMenuRequested); - connect(this, SIGNAL(itemActivated(QAction*)), this, SLOT(editAction(QAction*))); + connect(this, &ActionEditor::itemActivated, this, &ActionEditor::editAction); restoreSettings(); updateViewModeActions(); @@ -292,7 +292,7 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) if (m_formWindow != 0) { const ActionList actionList = m_formWindow->mainContainer()->findChildren<QAction*>(); foreach (QAction *action, actionList) - disconnect(action, SIGNAL(changed()), this, SLOT(slotActionChanged())); + disconnect(action, &QAction::changed, this, &ActionEditor::slotActionChanged); } m_formWindow = formWindow; @@ -321,7 +321,7 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) // Show unless it has a menu. However, listen for change on menu actions also as it might be removed if (!action->menu()) m_actionView->model()->addAction(action); - connect(action, SIGNAL(changed()), this, SLOT(slotActionChanged())); + connect(action, &QAction::changed, this, &ActionEditor::slotActionChanged); } setFilter(m_filter); @@ -419,7 +419,7 @@ void ActionEditor::manageAction(QAction *action) refreshIconPropertyChanged(action, sheet); m_actionView->setCurrentIndex(m_actionView->model()->addAction(action)); - connect(action, SIGNAL(changed()), this, SLOT(slotActionChanged())); + connect(action, &QAction::changed, this, &ActionEditor::slotActionChanged); } void ActionEditor::unmanageAction(QAction *action) @@ -427,7 +427,7 @@ void ActionEditor::unmanageAction(QAction *action) core()->metaDataBase()->remove(action); action->setParent(0); - disconnect(action, SIGNAL(changed()), this, SLOT(slotActionChanged())); + disconnect(action, &QAction::changed, this, &ActionEditor::slotActionChanged); const int row = m_actionView->model()->findAction(action); if (row != -1) @@ -780,10 +780,14 @@ void ActionEditor::slotPaste() void ActionEditor::slotContextMenuRequested(QContextMenuEvent *e, QAction *item) { + typedef void (QSignalMapper::*MapperQWidgetSignal)(QWidget *); + typedef void (QSignalMapper::*MapperVoidSlot)(); + // set up signal mapper if (!m_selectAssociatedWidgetsMapper) { m_selectAssociatedWidgetsMapper = new QSignalMapper(this); - connect(m_selectAssociatedWidgetsMapper, SIGNAL(mapped(QWidget*)), this, SLOT(slotSelectAssociatedWidget(QWidget*))); + connect(m_selectAssociatedWidgetsMapper, static_cast<MapperQWidgetSignal>(&QSignalMapper::mapped), + this, &ActionEditor::slotSelectAssociatedWidget); } QMenu menu(this); @@ -801,7 +805,8 @@ void ActionEditor::slotContextMenuRequested(QContextMenuEvent *e, QAction *item) foreach (QWidget *w, associatedWidgets) { QAction *action = associatedWidgetsSubMenu->addAction(w->objectName()); m_selectAssociatedWidgetsMapper->setMapping(action, w); - connect(action, SIGNAL(triggered()), m_selectAssociatedWidgetsMapper, SLOT(map())); + connect(action, &QAction::triggered, + m_selectAssociatedWidgetsMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); } } } diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp index e7b6c626..ae22efb0 100644 --- a/src/designer/src/lib/shared/actionrepository.cpp +++ b/src/designer/src/lib/shared/actionrepository.cpp @@ -340,8 +340,9 @@ ActionTreeView::ActionTreeView(ActionModel *model, QWidget *parent) : setTextElideMode(Qt::ElideMiddle); setModel(model); - connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); - connect(header(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(resizeColumnToContents(int))); + connect(this, &QTreeView::activated, this, &ActionTreeView::slotActivated); + connect(header(), &QHeaderView::sectionDoubleClicked, + this, &QTreeView::resizeColumnToContents); setIconSize(QSize(listModeIconSize, listModeIconSize)); @@ -381,23 +382,23 @@ void ActionTreeView::focusInEvent(QFocusEvent *event) QTreeView::focusInEvent(event); // Make property editor display current action if (QAction *a = currentAction()) - emit currentChanged(a); + emit currentActionChanged(a); } void ActionTreeView::contextMenuEvent(QContextMenuEvent *event) { - emit contextMenuRequested(event, m_model->actionAt(indexAt(event->pos()))); + emit actionContextMenuRequested(event, m_model->actionAt(indexAt(event->pos()))); } void ActionTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { - emit currentChanged(m_model->actionAt(current)); + emit currentActionChanged(m_model->actionAt(current)); QTreeView::currentChanged(current, previous); } void ActionTreeView::slotActivated(const QModelIndex &index) { - emit activated(m_model->actionAt(index)); + emit actionActivated(m_model->actionAt(index)); } void ActionTreeView::startDrag(Qt::DropActions supportedActions) @@ -416,7 +417,7 @@ ActionListView::ActionListView(ActionModel *model, QWidget *parent) : setDragDropMode(DragDrop); setModel(model); setTextElideMode(Qt::ElideMiddle); - connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); + connect(this, &QListView::activated, this, &ActionListView::slotActivated); // We actually want 'Static' as the user should be able to // drag away actions only (not to rearrange icons). @@ -463,23 +464,23 @@ void ActionListView::focusInEvent(QFocusEvent *event) QListView::focusInEvent(event); // Make property editor display current action if (QAction *a = currentAction()) - emit currentChanged(a); + emit currentActionChanged(a); } void ActionListView::contextMenuEvent(QContextMenuEvent *event) { - emit contextMenuRequested(event, m_model->actionAt(indexAt(event->pos()))); + emit actionContextMenuRequested(event, m_model->actionAt(indexAt(event->pos()))); } void ActionListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { - emit currentChanged(m_model->actionAt(current)); + emit currentActionChanged(m_model->actionAt(current)); QListView::currentChanged(current, previous); } void ActionListView::slotActivated(const QModelIndex &index) { - emit activated(m_model->actionAt(index)); + emit actionActivated(m_model->actionAt(index)); } void ActionListView::startDrag(Qt::DropActions supportedActions) @@ -497,21 +498,23 @@ ActionView::ActionView(QWidget *parent) : addWidget(m_actionListView); addWidget(m_actionTreeView); // Wire signals - connect(m_actionTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*,QAction*)), + connect(m_actionTreeView, SIGNAL(actionContextMenuRequested(QContextMenuEvent*,QAction*)), this, SIGNAL(contextMenuRequested(QContextMenuEvent*,QAction*))); - connect(m_actionListView, SIGNAL(contextMenuRequested(QContextMenuEvent*,QAction*)), + connect(m_actionListView, SIGNAL(actionContextMenuRequested(QContextMenuEvent*,QAction*)), this, SIGNAL(contextMenuRequested(QContextMenuEvent*,QAction*))); // make it possible for vs integration to reimplement edit action dialog // [which it shouldn't do actually] - connect(m_actionListView, SIGNAL(activated(QAction*)), this, SIGNAL(activated(QAction*))); - connect(m_actionTreeView, SIGNAL(activated(QAction*)), this, SIGNAL(activated(QAction*))); + connect(m_actionListView, &ActionListView::actionActivated, this, &ActionView::activated); + connect(m_actionTreeView, &ActionTreeView::actionActivated, this, &ActionView::activated); - connect(m_actionListView, SIGNAL(currentChanged(QAction*)),this, SLOT(slotCurrentChanged(QAction*))); - connect(m_actionTreeView, SIGNAL(currentChanged(QAction*)),this, SLOT(slotCurrentChanged(QAction*))); + connect(m_actionListView, &ActionListView::currentActionChanged, + this, &ActionView::slotCurrentChanged); + connect(m_actionTreeView, &ActionTreeView::currentActionChanged, + this, &ActionView::slotCurrentChanged); - connect(m_model, SIGNAL(resourceImageDropped(QString,QAction*)), - this, SIGNAL(resourceImageDropped(QString,QAction*))); + connect(m_model, &ActionModel::resourceImageDropped, + this, &ActionView::resourceImageDropped); // sync selection models QItemSelectionModel *selectionModel = m_actionTreeView->selectionModel(); diff --git a/src/designer/src/lib/shared/actionrepository_p.h b/src/designer/src/lib/shared/actionrepository_p.h index 76a06720..0bfe8b37 100644 --- a/src/designer/src/lib/shared/actionrepository_p.h +++ b/src/designer/src/lib/shared/actionrepository_p.h @@ -127,9 +127,9 @@ public slots: void filter(const QString &text); signals: - void contextMenuRequested(QContextMenuEvent *event, QAction *); - void currentChanged(QAction *action); - void activated(QAction *action); + void actionContextMenuRequested(QContextMenuEvent *event, QAction *); + void currentActionChanged(QAction *action); + void actionActivated(QAction *action); protected slots: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) Q_DECL_OVERRIDE; @@ -161,9 +161,9 @@ public slots: void filter(const QString &text); signals: - void contextMenuRequested(QContextMenuEvent *event, QAction *); - void currentChanged(QAction *action); - void activated(QAction *action); + void actionContextMenuRequested(QContextMenuEvent *event, QAction *); + void currentActionChanged(QAction *action); + void actionActivated(QAction *action); protected slots: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) Q_DECL_OVERRIDE; diff --git a/src/designer/src/lib/shared/codedialog.cpp b/src/designer/src/lib/shared/codedialog.cpp index 836dfa74..e10fe437 100644 --- a/src/designer/src/lib/shared/codedialog.cpp +++ b/src/designer/src/lib/shared/codedialog.cpp @@ -87,18 +87,18 @@ CodeDialog::CodeDialog(QWidget *parent) : const QIcon saveIcon = createIconSet(QStringLiteral("filesave.png")); QAction *saveAction = toolBar->addAction(saveIcon, tr("Save...")); - connect(saveAction, SIGNAL(triggered()), this, SLOT(slotSaveAs())); + connect(saveAction, &QAction::triggered, this, &CodeDialog::slotSaveAs); #ifndef QT_NO_CLIPBOARD const QIcon copyIcon = createIconSet(QStringLiteral("editcopy.png")); QAction *copyAction = toolBar->addAction(copyIcon, tr("Copy All")); - connect(copyAction, SIGNAL(triggered()), this, SLOT(copyAll())); + connect(copyAction, &QAction::triggered, this, &CodeDialog::copyAll); #endif QAction *findAction = toolBar->addAction( TextEditFindWidget::findIconSet(), tr("&Find in Text..."), - m_impl->m_findWidget, SLOT(activate())); + m_impl->m_findWidget, &AbstractFindWidget::activate); findAction->setShortcut(QKeySequence::Find); vBoxLayout->addWidget(toolBar); @@ -116,7 +116,7 @@ CodeDialog::CodeDialog(QWidget *parent) : // Button box QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); // Disable auto default QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close); diff --git a/src/designer/src/lib/shared/connectionedit.cpp b/src/designer/src/lib/shared/connectionedit.cpp index f87c3038..a91c7f80 100644 --- a/src/designer/src/lib/shared/connectionedit.cpp +++ b/src/designer/src/lib/shared/connectionedit.cpp @@ -947,8 +947,8 @@ ConnectionEdit::ConnectionEdit(QWidget *parent, QDesignerFormWindowInterface *fo setAttribute(Qt::WA_MouseTracking, true); setFocusPolicy(Qt::ClickFocus); - connect(form, SIGNAL(widgetRemoved(QWidget*)), this, SLOT(widgetRemoved(QWidget*))); - connect(form, SIGNAL(objectRemoved(QObject*)), this, SLOT(objectRemoved(QObject*))); + connect(form, &QDesignerFormWindowInterface::widgetRemoved, this, &ConnectionEdit::widgetRemoved); + connect(form, &QDesignerFormWindowInterface::objectRemoved, this, &ConnectionEdit::objectRemoved); } ConnectionEdit::~ConnectionEdit() @@ -1578,16 +1578,16 @@ void ConnectionEdit::createContextMenu(QMenu &menu) // Select QAction *selectAllAction = menu.addAction(tr("Select All")); selectAllAction->setEnabled(connectionList().size()); - connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll())); + connect(selectAllAction, &QAction::triggered, this, &ConnectionEdit::selectAll); QAction *deselectAllAction = menu.addAction(tr("Deselect All")); deselectAllAction->setEnabled(selection().size()); - connect(deselectAllAction, SIGNAL(triggered()), this, SLOT(selectNone())); + connect(deselectAllAction, &QAction::triggered, this, &ConnectionEdit::selectNone); menu.addSeparator(); // Delete QAction *deleteAction = menu.addAction(tr("Delete")); deleteAction->setShortcut(QKeySequence::Delete); deleteAction->setEnabled(!selection().isEmpty()); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteSelected())); + connect(deleteAction, &QAction::triggered, this, &ConnectionEdit::deleteSelected); } void ConnectionEdit::contextMenuEvent(QContextMenuEvent * event) diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp index 5aaf8122..e859ff6e 100644 --- a/src/designer/src/lib/shared/formlayoutmenu.cpp +++ b/src/designer/src/lib/shared/formlayoutmenu.cpp @@ -138,30 +138,32 @@ FormLayoutRowDialog::FormLayoutRowDialog(QDesignerFormEditorInterface *core, m_fieldNameEdited(false), m_buddyClicked(false) { + typedef void (QComboBox::*QComboIntSignal)(int); + Q_ASSERT(m_buddyMarkerRegexp.isValid()); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setModal(true); m_ui.setupUi(this); - connect(m_ui.labelTextLineEdit, SIGNAL(textEdited(QString)), this, SLOT(labelTextEdited(QString))); + connect(m_ui.labelTextLineEdit, &QLineEdit::textEdited, this, &FormLayoutRowDialog::labelTextEdited); QRegExpValidator *nameValidator = new QRegExpValidator(QRegExp(QStringLiteral("^[a-zA-Z0-9_]+$")), this); Q_ASSERT(nameValidator->regExp().isValid()); m_ui.labelNameLineEdit->setValidator(nameValidator); - connect(m_ui.labelNameLineEdit, SIGNAL(textEdited(QString)), - this, SLOT(labelNameEdited(QString))); + connect(m_ui.labelNameLineEdit, &QLineEdit::textEdited, + this, &FormLayoutRowDialog::labelNameEdited); m_ui.fieldNameLineEdit->setValidator(nameValidator); - connect(m_ui.fieldNameLineEdit, SIGNAL(textEdited(QString)), - this, SLOT(fieldNameEdited(QString))); + connect(m_ui.fieldNameLineEdit, &QLineEdit::textEdited, + this, &FormLayoutRowDialog::fieldNameEdited); - connect(m_ui.buddyCheckBox, SIGNAL(clicked()), this, SLOT(buddyClicked())); + connect(m_ui.buddyCheckBox, &QAbstractButton::clicked, this, &FormLayoutRowDialog::buddyClicked); m_ui.fieldClassComboBox->addItems(fieldWidgetClasses(core)); m_ui.fieldClassComboBox->setCurrentIndex(0); - connect(m_ui.fieldClassComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(fieldClassChanged(int))); + connect(m_ui.fieldClassComboBox, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged), + this, &FormLayoutRowDialog::fieldClassChanged); updateOkButton(); } @@ -475,7 +477,7 @@ FormLayoutMenu::FormLayoutMenu(QObject *parent) : m_separator2(new QAction(this)) { m_separator1->setSeparator(true); - connect(m_populateFormAction, SIGNAL(triggered()), this, SLOT(slotAddRow())); + connect(m_populateFormAction, &QAction::triggered, this, &FormLayoutMenu::slotAddRow); m_separator2->setSeparator(true); } diff --git a/src/designer/src/lib/shared/formwindowbase.cpp b/src/designer/src/lib/shared/formwindowbase.cpp index 9b230b42..4bab50ef 100644 --- a/src/designer/src/lib/shared/formwindowbase.cpp +++ b/src/designer/src/lib/shared/formwindowbase.cpp @@ -112,7 +112,7 @@ FormWindowBase::FormWindowBase(QDesignerFormEditorInterface *core, QWidget *pare m_d->m_pixmapCache = new DesignerPixmapCache(this); m_d->m_iconCache = new DesignerIconCache(m_d->m_pixmapCache, this); if (core->integration()->hasFeature(QDesignerIntegrationInterface::DefaultWidgetActionFeature)) - connect(this, SIGNAL(activated(QWidget*)), this, SLOT(triggerDefaultAction(QWidget*))); + connect(this, &QDesignerFormWindowInterface::activated, this, &FormWindowBase::triggerDefaultAction); } FormWindowBase::~FormWindowBase() @@ -475,7 +475,7 @@ FormWindowBase::LineTerminatorMode FormWindowBase::lineTerminatorMode() const void FormWindowBase::triggerDefaultAction(QWidget *widget) { if (QAction *action = qdesigner_internal::preferredEditAction(core(), widget)) - QTimer::singleShot(0, action, SIGNAL(triggered())); + QTimer::singleShot(0, action, &QAction::trigger); } QStringList FormWindowBase::checkContents() const diff --git a/src/designer/src/lib/shared/gridpanel.cpp b/src/designer/src/lib/shared/gridpanel.cpp index f63039a5..5cb98aaa 100644 --- a/src/designer/src/lib/shared/gridpanel.cpp +++ b/src/designer/src/lib/shared/gridpanel.cpp @@ -45,7 +45,7 @@ GridPanel::GridPanel(QWidget *parentWidget) : m_ui = new Ui::GridPanel; m_ui->setupUi(this); - connect(m_ui->m_resetButton, SIGNAL(clicked()), this, SLOT(reset())); + connect(m_ui->m_resetButton, &QAbstractButton::clicked, this, &GridPanel::reset); } GridPanel::~GridPanel() diff --git a/src/designer/src/lib/shared/iconselector.cpp b/src/designer/src/lib/shared/iconselector.cpp index 9b0a45b5..1e90ee28 100644 --- a/src/designer/src/lib/shared/iconselector.cpp +++ b/src/designer/src/lib/shared/iconselector.cpp @@ -106,7 +106,7 @@ void LanguageResourceDialogPrivate::init(LanguageResourceDialog *p) layout->addWidget(m_browser); layout->addWidget(m_dialogButtonBox); QObject::connect(m_dialogButtonBox, SIGNAL(accepted()), p, SLOT(slotAccepted())); - QObject::connect(m_dialogButtonBox, SIGNAL(rejected()), p, SLOT(reject())); + QObject::connect(m_dialogButtonBox, &QDialogButtonBox::rejected, p, &QDialog::reject); QObject::connect(m_browser, SIGNAL(currentPathChanged(QString)), p, SLOT(slotPathChanged(QString))); QObject::connect(m_browser, SIGNAL(pathActivated(QString)), p, SLOT(slotAccepted())); p->setModal(true); diff --git a/src/designer/src/lib/shared/layout.cpp b/src/designer/src/lib/shared/layout.cpp index 2182ce62..789f185c 100644 --- a/src/designer/src/lib/shared/layout.cpp +++ b/src/designer/src/lib/shared/layout.cpp @@ -195,7 +195,7 @@ void Layout::setup() // widgets to get informed if one gets deleted to be able to // handle that and do not crash in this case foreach (QWidget *w, m_widgets) { - connect(w, SIGNAL(destroyed()), this, SLOT(widgetDestroyed())); + connect(w, &QObject::destroyed, this, &Layout::widgetDestroyed); m_startPoint = QPoint(qMin(m_startPoint.x(), w->x()), qMin(m_startPoint.y(), w->y())); const QRect rc(w->geometry()); diff --git a/src/designer/src/lib/shared/metadatabase.cpp b/src/designer/src/lib/shared/metadatabase.cpp index 2330fdd9..a0f22249 100644 --- a/src/designer/src/lib/shared/metadatabase.cpp +++ b/src/designer/src/lib/shared/metadatabase.cpp @@ -158,8 +158,7 @@ void MetaDataBase::add(QObject *object) if (debugMetaDatabase) { qDebug() << "MetaDataBase::add: New item " << object->metaObject()->className() << item->name(); } - connect(object, SIGNAL(destroyed(QObject*)), - this, SLOT(slotDestroyed(QObject*))); + connect(object, &QObject::destroyed, this, &MetaDataBase::slotDestroyed); emit changed(); } diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp index 95a2220e..57ce92fa 100644 --- a/src/designer/src/lib/shared/morphmenu.cpp +++ b/src/designer/src/lib/shared/morphmenu.cpp @@ -587,6 +587,9 @@ void MorphMenu::slotMorph(const QString &newClassName) bool MorphMenu::populateMenu(QWidget *w, QDesignerFormWindowInterface *fw) { + typedef void (QSignalMapper::*MapperVoidSlot)(); + typedef void (QSignalMapper::*MapperStringSignal)(const QString &); + m_widget = 0; m_formWindow = 0; @@ -614,7 +617,8 @@ bool MorphMenu::populateMenu(QWidget *w, QDesignerFormWindowInterface *fw) m_menu = new QMenu; m_subMenuAction->setMenu(m_menu); m_mapper = new QSignalMapper(this); - connect(m_mapper , SIGNAL(mapped(QString)), this, SLOT(slotMorph(QString))); + connect(m_mapper, static_cast<MapperStringSignal>(&QSignalMapper::mapped), + this, &MorphMenu::slotMorph); } // Add actions @@ -623,7 +627,8 @@ bool MorphMenu::populateMenu(QWidget *w, QDesignerFormWindowInterface *fw) if (*it != oldClassName) { QAction *a = m_menu->addAction(*it); m_mapper->setMapping (a, *it); - connect(a, SIGNAL(triggered()), m_mapper, SLOT(map())); + connect(a, &QAction::triggered, + m_mapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); } } m_subMenuAction->setVisible(true); diff --git a/src/designer/src/lib/shared/newactiondialog.cpp b/src/designer/src/lib/shared/newactiondialog.cpp index bc90b670..0d1fab4c 100644 --- a/src/designer/src/lib/shared/newactiondialog.cpp +++ b/src/designer/src/lib/shared/newactiondialog.cpp @@ -84,10 +84,11 @@ NewActionDialog::NewActionDialog(ActionEditor *parent) : m_ui->setupUi(this); m_ui->tooltipEditor->setTextPropertyValidationMode(ValidationRichText); - connect(m_ui->toolTipToolButton, SIGNAL(clicked()), this, SLOT(slotEditToolTip())); + connect(m_ui->toolTipToolButton, &QAbstractButton::clicked, this, &NewActionDialog::slotEditToolTip); m_ui->keysequenceResetToolButton->setIcon(createIconSet(QStringLiteral("resetproperty.png"))); - connect(m_ui->keysequenceResetToolButton, SIGNAL(clicked()), this, SLOT(slotResetKeySequence())); + connect(m_ui->keysequenceResetToolButton, &QAbstractButton::clicked, + this, &NewActionDialog::slotResetKeySequence); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_ui->editActionText->setFocus(); diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp index fb552df4..b2b0640a 100644 --- a/src/designer/src/lib/shared/newformwidget.cpp +++ b/src/designer/src/lib/shared/newformwidget.cpp @@ -132,6 +132,7 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent m_currentItem(0), m_acceptedItem(0) { + typedef void (QComboBox::*QComboIntSignal)(int); typedef QList<qdesigner_internal::DeviceProfile> DeviceProfileList; m_ui->setupUi(this); @@ -183,7 +184,8 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent // Fill profile combo m_deviceProfiles = settings.deviceProfiles(); m_ui->profileComboBox->addItem(tr("None")); - connect(m_ui->profileComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotDeviceProfileIndexChanged(int))); + connect(m_ui->profileComboBox, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged), + this, &NewFormWidget::slotDeviceProfileIndexChanged); if (m_deviceProfiles.empty()) { m_ui->profileComboBox->setEnabled(false); } else { diff --git a/src/designer/src/lib/shared/orderdialog.cpp b/src/designer/src/lib/shared/orderdialog.cpp index 48f38160..25bae7ad 100644 --- a/src/designer/src/lib/shared/orderdialog.cpp +++ b/src/designer/src/lib/shared/orderdialog.cpp @@ -58,10 +58,12 @@ OrderDialog::OrderDialog(QWidget *parent) : m_ui->upButton->setIcon(createIconSet(QString::fromUtf8("up.png"))); m_ui->downButton->setIcon(createIconSet(QString::fromUtf8("down.png"))); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(slotReset())); + connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QAbstractButton::clicked, + this, &OrderDialog::slotReset); // Catch the remove operation of a DnD operation in QAbstractItemView::InternalMove mode to enable buttons // Selection mode is 'contiguous' to enable DnD of groups - connect(m_ui->pageList->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(slotEnableButtonsAfterDnD())); + connect(m_ui->pageList->model(), &QAbstractItemModel::rowsRemoved, + this, &OrderDialog::slotEnableButtonsAfterDnD); m_ui->upButton->setEnabled(false); m_ui->downButton->setEnabled(false); diff --git a/src/designer/src/lib/shared/plaintexteditor.cpp b/src/designer/src/lib/shared/plaintexteditor.cpp index d3f885f2..ca2c40ac 100644 --- a/src/designer/src/lib/shared/plaintexteditor.cpp +++ b/src/designer/src/lib/shared/plaintexteditor.cpp @@ -63,8 +63,8 @@ PlainTextEditorDialog::PlainTextEditorDialog(QDesignerFormEditorInterface *core, QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); QPushButton *ok_button = buttonBox->button(QDialogButtonBox::Ok); ok_button->setDefault(true); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); vlayout->addWidget(buttonBox); QDesignerSettingsInterface *settings = core->settingsManager(); diff --git a/src/designer/src/lib/shared/plugindialog.cpp b/src/designer/src/lib/shared/plugindialog.cpp index ecf9acb8..40f35b27 100644 --- a/src/designer/src/lib/shared/plugindialog.cpp +++ b/src/designer/src/lib/shared/plugindialog.cpp @@ -82,7 +82,7 @@ PluginDialog::PluginDialog(QDesignerFormEditorInterface *core, QWidget *parent) const QString tooltip = tr("Scan for newly installed custom widget plugins."); updateButton->setToolTip(tooltip); updateButton->setWhatsThis(tooltip); - connect(updateButton, SIGNAL(clicked()), this, SLOT(updateCustomWidgetPlugins())); + connect(updateButton, &QAbstractButton::clicked, this, &PluginDialog::updateCustomWidgetPlugins); ui.buttonBox->addButton(updateButton, QDialogButtonBox::ActionRole); } diff --git a/src/designer/src/lib/shared/previewconfigurationwidget.cpp b/src/designer/src/lib/shared/previewconfigurationwidget.cpp index 01765d33..71595f9c 100644 --- a/src/designer/src/lib/shared/previewconfigurationwidget.cpp +++ b/src/designer/src/lib/shared/previewconfigurationwidget.cpp @@ -140,7 +140,8 @@ PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::PreviewConfigurat // sheet m_ui.m_appStyleSheetLineEdit->setTextPropertyValidationMode(qdesigner_internal::ValidationStyleSheet); m_ui.m_appStyleSheetClearButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("resetproperty.png"))); - QObject::connect(m_ui.m_appStyleSheetClearButton, SIGNAL(clicked()), m_ui.m_appStyleSheetLineEdit, SLOT(clear())); + QObject::connect(m_ui.m_appStyleSheetClearButton, &QAbstractButton::clicked, + m_ui.m_appStyleSheetLineEdit, &qdesigner_internal::TextPropertyEditor::clear); m_ui.m_skinRemoveButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("editdelete.png"))); // skins: find default skins (resources) @@ -317,9 +318,14 @@ PreviewConfigurationWidget::PreviewConfigurationWidget(QDesignerFormEditorInterf QGroupBox(parent), m_impl(new PreviewConfigurationWidgetPrivate(core, this)) { - connect(m_impl->appStyleSheetChangeButton(), SIGNAL(clicked()), this, SLOT(slotEditAppStyleSheet())); - connect(m_impl->skinRemoveButton(), SIGNAL(clicked()), this, SLOT(slotDeleteSkinEntry())); - connect(m_impl->skinCombo(), SIGNAL(currentIndexChanged(int)), this, SLOT(slotSkinChanged(int))); + typedef void (QComboBox::*QComboIntSignal)(int); + + connect(m_impl->appStyleSheetChangeButton(), &QAbstractButton::clicked, + this, &PreviewConfigurationWidget::slotEditAppStyleSheet); + connect(m_impl->skinRemoveButton(), &QAbstractButton::clicked, + this, &PreviewConfigurationWidget::slotDeleteSkinEntry); + connect(m_impl->skinCombo(), static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged), + this, &PreviewConfigurationWidget::slotSkinChanged); m_impl->retrieveSettings(); } diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp index 71a1f72b..12bab9ff 100644 --- a/src/designer/src/lib/shared/previewmanager.cpp +++ b/src/designer/src/lib/shared/previewmanager.cpp @@ -193,11 +193,11 @@ PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWi m_directionRightAction(0), m_closeAction(0) { - connect(this, SIGNAL(skinKeyPressEvent(int,QString,bool)), - this, SLOT(slotSkinKeyPressEvent(int,QString,bool))); - connect(this, SIGNAL(skinKeyReleaseEvent(int,QString,bool)), - this, SLOT(slotSkinKeyReleaseEvent(int,QString,bool))); - connect(this, SIGNAL(popupMenu()), this, SLOT(slotPopupMenu())); + connect(this, &PreviewDeviceSkin::skinKeyPressEvent, + this, &PreviewDeviceSkin::slotSkinKeyPressEvent); + connect(this, &PreviewDeviceSkin::skinKeyReleaseEvent, + this, &PreviewDeviceSkin::slotSkinKeyReleaseEvent); + connect(this, &PreviewDeviceSkin::popupMenu, this, &PreviewDeviceSkin::slotPopupMenu); } void PreviewDeviceSkin::setPreview(QWidget *formWidget) @@ -246,7 +246,7 @@ void PreviewDeviceSkin::slotPopupMenu() // Create actions if (!m_directionUpAction) { QActionGroup *directionGroup = new QActionGroup(this); - connect(directionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotDirection(QAction*))); + connect(directionGroup, &QActionGroup::triggered, this, &PreviewDeviceSkin::slotDirection); directionGroup->setExclusive(true); m_directionUpAction = createCheckableActionIntData(tr("&Portrait"), DirectionUp, m_direction, directionGroup, this); //: Rotate form preview counter-clockwise @@ -254,7 +254,7 @@ void PreviewDeviceSkin::slotPopupMenu() //: Rotate form preview clockwise m_directionRightAction = createCheckableActionIntData(tr("&Landscape (CW)"), DirectionRight, m_direction, directionGroup, this); m_closeAction = new QAction(tr("&Close"), this); - connect(m_closeAction, SIGNAL(triggered()), parentWidget(), SLOT(close())); + connect(m_closeAction, &QAction::triggered, parentWidget(), &QWidget::close); } menu.addAction(m_directionUpAction); menu.addAction(m_directionLeftAction); @@ -360,8 +360,8 @@ ZoomablePreviewDeviceSkin::ZoomablePreviewDeviceSkin(const DeviceSkinParameters m_zoomSubMenuAction(0), m_zoomWidget(new DesignerZoomWidget) { - connect(m_zoomMenu, SIGNAL(zoomChanged(int)), this, SLOT(setZoomPercent(int))); - connect(m_zoomMenu, SIGNAL(zoomChanged(int)), this, SIGNAL(zoomPercentChanged(int))); + connect(m_zoomMenu, &ZoomMenu::zoomChanged, this, &ZoomablePreviewDeviceSkin::setZoomPercent); + connect(m_zoomMenu, &ZoomMenu::zoomChanged, this, &ZoomablePreviewDeviceSkin::zoomPercentChanged); m_zoomWidget->setZoomContextMenuEnabled(false); m_zoomWidget->setWidgetZoomContextMenuEnabled(false); m_zoomWidget->resize(screenSize()); @@ -692,7 +692,7 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw, if (deviceSkin.isEmpty()) { if (zoomable) { // Embed into ZoomWidget ZoomWidget *zw = new DesignerZoomWidget; - connect(zw->zoomMenu(), SIGNAL(zoomChanged(int)), this, SLOT(slotZoomChanged(int))); + connect(zw->zoomMenu(), &ZoomMenu::zoomChanged, this, &PreviewManager::slotZoomChanged); zw->setWindowTitle(title); zw->setWidget(formWidget); // Keep any widgets' context menus working, do not use global menu @@ -700,7 +700,7 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw, zw->setParent(fw->window(), previewWindowFlags(formWidget)); // Make preview close when Widget closes (Dialog/accept, etc) formWidget->setAttribute(Qt::WA_DeleteOnClose, true); - connect(formWidget, SIGNAL(destroyed()), zw, SLOT(close())); + connect(formWidget, &QObject::destroyed, zw, &QWidget::close); zw->setZoom(initialZoom); zw->setProperty(WidgetFactory::disableStyleCustomPaintingPropertyC, QVariant(true)); return zw; @@ -725,7 +725,8 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw, if (zoomable) { ZoomablePreviewDeviceSkin *zds = new ZoomablePreviewDeviceSkin(it.value(), skinContainer); zds->setZoomPercent(initialZoom); - connect(zds, SIGNAL(zoomPercentChanged(int)), this, SLOT(slotZoomChanged(int))); + connect(zds, &ZoomablePreviewDeviceSkin::zoomPercentChanged, + this, &PreviewManager::slotZoomChanged); skin = zds; } else { skin = new PreviewDeviceSkin(it.value(), skinContainer); @@ -733,7 +734,7 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw, skin->setPreview(formWidget); // Make preview close when Widget closes (Dialog/accept, etc) formWidget->setAttribute(Qt::WA_DeleteOnClose, true); - connect(formWidget, SIGNAL(destroyed()), skinContainer, SLOT(close())); + connect(formWidget, &QObject::destroyed, skinContainer, &QWidget::close); skinContainer->setWindowTitle(title); skinContainer->setProperty(WidgetFactory::disableStyleCustomPaintingPropertyC, QVariant(true)); return skinContainer; @@ -766,10 +767,12 @@ QWidget *PreviewManager::showPreview(const QDesignerFormWindowInterface *fw, case SingleFormNonModalPreview: case MultipleFormNonModalPreview: widget->setWindowModality(Qt::NonModal); - connect(fw, SIGNAL(changed()), widget, SLOT(close())); - connect(fw, SIGNAL(destroyed()), widget, SLOT(close())); - if (d->m_mode == SingleFormNonModalPreview) - connect(fw->core()->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), widget, SLOT(close())); + connect(fw, &QDesignerFormWindowInterface::changed, widget, &QWidget::close); + connect(fw, &QObject::destroyed, widget, &QWidget::close); + if (d->m_mode == SingleFormNonModalPreview) { + connect(fw->core()->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged, + widget, &QWidget::close); + } break; } // Semi-smart algorithm to position previews: diff --git a/src/designer/src/lib/shared/promotionmodel.cpp b/src/designer/src/lib/shared/promotionmodel.cpp index 4d437cef..5645d886 100644 --- a/src/designer/src/lib/shared/promotionmodel.cpp +++ b/src/designer/src/lib/shared/promotionmodel.cpp @@ -113,7 +113,7 @@ namespace qdesigner_internal { PromotionModel::PromotionModel(QDesignerFormEditorInterface *core) : m_core(core) { - connect(this, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(slotItemChanged(QStandardItem*))); + connect(this, &QStandardItemModel::itemChanged, this, &PromotionModel::slotItemChanged); } void PromotionModel::initializeHeaders() { diff --git a/src/designer/src/lib/shared/promotiontaskmenu.cpp b/src/designer/src/lib/shared/promotiontaskmenu.cpp index dbd65d1c..4697447f 100644 --- a/src/designer/src/lib/shared/promotiontaskmenu.cpp +++ b/src/designer/src/lib/shared/promotiontaskmenu.cpp @@ -80,9 +80,9 @@ PromotionTaskMenu::PromotionTaskMenu(QWidget *widget,Mode mode, QObject *parent) m_promoteLabel(tr("Promote to")), m_demoteLabel(tr("Demote to %1")) { - connect(m_globalEditAction, SIGNAL(triggered()), this, SLOT(slotEditPromotedWidgets())); - connect(m_EditPromoteToAction, SIGNAL(triggered()), this, SLOT(slotEditPromoteTo())); - connect(m_EditSignalsSlotsAction, SIGNAL(triggered()), this, SLOT(slotEditSignalsSlots())); + connect(m_globalEditAction, &QAction::triggered, this, &PromotionTaskMenu::slotEditPromotedWidgets); + connect(m_EditPromoteToAction, &QAction::triggered, this, &PromotionTaskMenu::slotEditPromoteTo); + connect(m_EditSignalsSlotsAction, &QAction::triggered, this, &PromotionTaskMenu::slotEditSignalsSlots); } PromotionTaskMenu::Mode PromotionTaskMenu::mode() const @@ -117,6 +117,9 @@ void PromotionTaskMenu::setDemoteLabel(const QString &demoteLabel) PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDesignerFormWindowInterface *formWindow) { + typedef void (QSignalMapper::*MapperVoidSlot)(); + typedef void (QSignalMapper::*MapperStringSignal)(const QString &); + // clear out old if (!m_promotionActions.empty()) { qDeleteAll(m_promotionActions); @@ -137,7 +140,7 @@ PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDe if (isPromoted(formWindow->core(), m_widget)) { const QString label = m_demoteLabel.arg( promotedExtends(core , m_widget)); QAction *demoteAction = new QAction(label, this); - connect(demoteAction, SIGNAL(triggered()), this, SLOT(slotDemoteFromCustomWidget())); + connect(demoteAction, &QAction::triggered, this, &PromotionTaskMenu::slotDemoteFromCustomWidget); m_promotionActions.push_back(demoteAction); return CanDemote; } @@ -151,7 +154,8 @@ PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDe // Set up a signal mapper to associate class names if (!m_promotionMapper) { m_promotionMapper = new QSignalMapper(this); - connect(m_promotionMapper, SIGNAL(mapped(QString)), this, SLOT(slotPromoteToCustomWidget(QString))); + connect(m_promotionMapper, static_cast<MapperStringSignal>(&QSignalMapper::mapped), + this, &PromotionTaskMenu::slotPromoteToCustomWidget); } QMenu *candidatesMenu = new QMenu(); @@ -161,7 +165,8 @@ PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDe for (WidgetDataBaseItemList::const_iterator it = candidates.constBegin(); it != cend; ++it) { const QString customClassName = (*it)->name(); QAction *action = new QAction((*it)->name(), this); - connect(action, SIGNAL(triggered()), m_promotionMapper, SLOT(map())); + connect(action, &QAction::triggered, + m_promotionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); m_promotionMapper->setMapping(action, customClassName); candidatesMenu->addAction(action); } diff --git a/src/designer/src/lib/shared/propertylineedit.cpp b/src/designer/src/lib/shared/propertylineedit.cpp index b5be0c42..12141ecf 100644 --- a/src/designer/src/lib/shared/propertylineedit.cpp +++ b/src/designer/src/lib/shared/propertylineedit.cpp @@ -77,8 +77,7 @@ namespace qdesigner_internal { if (m_wantNewLine) { menu->addSeparator(); - QAction* nlAction = menu->addAction(tr("Insert line break")); - connect(nlAction, SIGNAL(triggered()), this, SLOT(insertNewLine())); + menu->addAction(tr("Insert line break"), this, &PropertyLineEdit::insertNewLine); } menu->exec(event->globalPos()); diff --git a/src/designer/src/lib/shared/qdesigner_menu.cpp b/src/designer/src/lib/shared/qdesigner_menu.cpp index d5bb56d0..7bed84f1 100644 --- a/src/designer/src/lib/shared/qdesigner_menu.cpp +++ b/src/designer/src/lib/shared/qdesigner_menu.cpp @@ -97,16 +97,16 @@ QDesignerMenu::QDesignerMenu(QWidget *parent) : setAcceptDrops(true); // ### fake setSeparatorsCollapsible(false); - connect(m_adjustSizeTimer, SIGNAL(timeout()), this, SLOT(slotAdjustSizeNow())); + connect(m_adjustSizeTimer, &QTimer::timeout, this, &QDesignerMenu::slotAdjustSizeNow); m_addItem->setText(tr("Type Here")); addAction(m_addItem); m_addSeparator->setText(tr("Add Separator")); addAction(m_addSeparator); - connect(m_showSubMenuTimer, SIGNAL(timeout()), this, SLOT(slotShowSubMenuNow())); + connect(m_showSubMenuTimer, &QTimer::timeout, this, &QDesignerMenu::slotShowSubMenuNow); - connect(m_deactivateWindowTimer, SIGNAL(timeout()), this, SLOT(slotDeactivateNow())); + connect(m_deactivateWindowTimer, &QTimer::timeout, this, &QDesignerMenu::slotDeactivateNow); m_editor->setObjectName(QStringLiteral("__qt__passive_editor")); m_editor->hide(); @@ -482,8 +482,8 @@ bool QDesignerMenu::handleContextMenuEvent(QWidget *, QContextMenuEvent *event) removeAction = menu.addAction(tr("Remove action '%1'").arg(action->objectName())); removeAction->setData(itemData); - connect(addSeparatorAction, SIGNAL(triggered(bool)), this, SLOT(slotAddSeparator())); - connect(removeAction, SIGNAL(triggered(bool)), this, SLOT(slotRemoveSelectedAction())); + connect(addSeparatorAction, &QAction::triggered, this, &QDesignerMenu::slotAddSeparator); + connect(removeAction, &QAction::triggered, this, &QDesignerMenu::slotRemoveSelectedAction); menu.exec(event->globalPos()); return true; diff --git a/src/designer/src/lib/shared/qdesigner_menubar.cpp b/src/designer/src/lib/shared/qdesigner_menubar.cpp index b606a042..479451f4 100644 --- a/src/designer/src/lib/shared/qdesigner_menubar.cpp +++ b/src/designer/src/lib/shared/qdesigner_menubar.cpp @@ -399,7 +399,7 @@ ActionList QDesignerMenuBar::contextMenuActions() QAction *remove_action = new QAction(tr("Remove Menu '%1'").arg(action->menu()->objectName()), 0); remove_action->setData(itemData); - connect(remove_action, SIGNAL(triggered()), this, SLOT(deleteMenu())); + connect(remove_action, &QAction::triggered, this, &QDesignerMenuBar::deleteMenu); rc.push_back(remove_action); QAction *sep = new QAction(0); sep->setSeparator(true); @@ -410,7 +410,7 @@ ActionList QDesignerMenuBar::contextMenuActions() m_promotionTaskMenu->addActions(formWindow(), PromotionTaskMenu::TrailingSeparator, rc); QAction *remove_menubar = new QAction(tr("Remove Menu Bar"), 0); - connect(remove_menubar, SIGNAL(triggered()), this, SLOT(slotRemoveMenuBar())); + connect(remove_menubar, &QAction::triggered, this, &QDesignerMenuBar::slotRemoveMenuBar); rc.push_back(remove_menubar); return rc; } diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp index d49e1c64..c0997a05 100644 --- a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp +++ b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp @@ -89,8 +89,10 @@ namespace qdesigner_internal { QHBoxLayout *hboxLayout = new QHBoxLayout(this); m_classNameEdit->setValidator(new QRegExpValidator(QRegExp(QStringLiteral("[_a-zA-Z:][:_a-zA-Z0-9]*")), m_classNameEdit)); - connect(m_classNameEdit, SIGNAL(textChanged(QString)), this, SLOT(slotNameChanged(QString))); - connect(m_includeFileEdit, SIGNAL(textChanged(QString)), this, SLOT(slotIncludeFileChanged(QString))); + connect(m_classNameEdit, &QLineEdit::textChanged, + this, &NewPromotedClassPanel::slotNameChanged); + connect(m_includeFileEdit, &QLineEdit::textChanged, + this, &NewPromotedClassPanel::slotIncludeFileChanged); m_baseClassCombo->setEditable(false); m_baseClassCombo->addItems(baseClasses); @@ -110,13 +112,13 @@ namespace qdesigner_internal { QVBoxLayout *buttonLayout = new QVBoxLayout(); m_addButton->setAutoDefault(false); - connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAdd())); + connect(m_addButton, &QAbstractButton::clicked, this, &NewPromotedClassPanel::slotAdd); m_addButton->setEnabled(false); buttonLayout->addWidget(m_addButton); QPushButton *resetButton = new QPushButton(tr("Reset")); resetButton->setAutoDefault(false); - connect(resetButton, SIGNAL(clicked()), this, SLOT(slotReset())); + connect(resetButton, &QAbstractButton::clicked, this, &NewPromotedClassPanel::slotReset); buttonLayout->addWidget(resetButton); buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding)); @@ -218,11 +220,11 @@ namespace qdesigner_internal { m_treeView->setMinimumWidth(450); m_treeView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(slotSelectionChanged(QItemSelection,QItemSelection))); + connect(m_treeView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &QDesignerPromotionDialog::slotSelectionChanged); - connect(m_treeView, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(slotTreeViewContextMenu(QPoint))); + connect(m_treeView, &QWidget::customContextMenuRequested, + this, &QDesignerPromotionDialog::slotTreeViewContextMenu); QHeaderView *headerView = m_treeView->header(); headerView->setSectionResizeMode(QHeaderView::ResizeToContents); @@ -232,7 +234,7 @@ namespace qdesigner_internal { hboxLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); m_removeButton->setAutoDefault(false); - connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemove())); + connect(m_removeButton, &QAbstractButton::clicked, this, &QDesignerPromotionDialog::slotRemove); m_removeButton->setEnabled(false); hboxLayout->addWidget(m_removeButton); treeViewVBoxLayout->addLayout(hboxLayout); @@ -249,18 +251,19 @@ namespace qdesigner_internal { NewPromotedClassPanel *newPromotedClassPanel = new NewPromotedClassPanel(baseClassNameList, preselectedBaseClass); newPromotedClassPanel->setPromotedHeaderSuffix(core->integration()->headerSuffix()); newPromotedClassPanel->setPromotedHeaderLowerCase(core->integration()->isHeaderLowercase()); - connect(newPromotedClassPanel, SIGNAL(newPromotedClass(PromotionParameters,bool*)), this, SLOT(slotNewPromotedClass(PromotionParameters,bool*))); - connect(this, SIGNAL(selectedBaseClassChanged(QString)), - newPromotedClassPanel, SLOT(chooseBaseClass(QString))); + connect(newPromotedClassPanel, &NewPromotedClassPanel::newPromotedClass, + this, &QDesignerPromotionDialog::slotNewPromotedClass); + connect(this, &QDesignerPromotionDialog::selectedBaseClassChanged, + newPromotedClassPanel, &NewPromotedClassPanel::chooseBaseClass); vboxLayout->addWidget(newPromotedClassPanel); // button box vboxLayout->addWidget(m_buttonBox); // connect model - connect(m_model, SIGNAL(includeFileChanged(QDesignerWidgetDataBaseItemInterface*,QString)), - this, SLOT(slotIncludeFileChanged(QDesignerWidgetDataBaseItemInterface*,QString))); + connect(m_model, &PromotionModel::includeFileChanged, + this, &QDesignerPromotionDialog::slotIncludeFileChanged); - connect(m_model, SIGNAL(classNameChanged(QDesignerWidgetDataBaseItemInterface*,QString)), - this, SLOT(slotClassNameChanged(QDesignerWidgetDataBaseItemInterface*,QString))); + connect(m_model, &PromotionModel::classNameChanged, + this, &QDesignerPromotionDialog::slotClassNameChanged); // focus if (m_mode == ModeEditChooseClass) @@ -272,11 +275,12 @@ namespace qdesigner_internal { QDialogButtonBox *QDesignerPromotionDialog::createButtonBox() { QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Close); - connect(buttonBox , SIGNAL(accepted()), this, SLOT(slotAcceptPromoteTo())); + connect(buttonBox, &QDialogButtonBox::accepted, + this, &QDesignerPromotionDialog::slotAcceptPromoteTo); buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Promote")); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); return buttonBox; } @@ -287,7 +291,7 @@ namespace qdesigner_internal { } void QDesignerPromotionDialog::delayedUpdateFromWidgetDatabase() { - QTimer::singleShot(0, this, SLOT(slotUpdateFromWidgetDatabase())); + QTimer::singleShot(0, this, &QDesignerPromotionDialog::slotUpdateFromWidgetDatabase); } const QStringList &QDesignerPromotionDialog::baseClassNames(const QDesignerPromotionInterface *promotion) { @@ -426,7 +430,8 @@ namespace qdesigner_internal { QMenu menu; QAction *signalSlotAction = menu.addAction(tr("Change signals/slots...")); - connect(signalSlotAction, SIGNAL(triggered()), this, SLOT(slotEditSignalsSlots())); + connect(signalSlotAction, &QAction::triggered, + this, &QDesignerPromotionDialog::slotEditSignalsSlots); menu.exec(m_treeView->viewport()->mapToGlobal(pos)); } diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp index 0b667256..41b182b5 100644 --- a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp @@ -91,7 +91,8 @@ QDesignerPropertyEditor::QDesignerPropertyEditor(QWidget *parent, Qt::WindowFlag m_propertyChangedForwardingBlocked(false) { // Make old signal work for compatibility - connect(this, SIGNAL(propertyChanged(QString,QVariant)), this, SLOT(slotPropertyChanged(QString,QVariant))); + connect(this, &QDesignerPropertyEditorInterface::propertyChanged, + this, &QDesignerPropertyEditor::slotPropertyChanged); } static inline bool isDynamicProperty(QDesignerFormEditorInterface *core, QObject *object, diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp index 6ca1dbe9..607398d7 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -1668,13 +1668,13 @@ QObject *QDesignerAbstractPropertySheetFactory::extension(QObject *object, const ExtensionMap::iterator it = m_impl->m_extensions.find(object); if (it == m_impl->m_extensions.end()) { if (QObject *ext = createPropertySheet(object, const_cast<QDesignerAbstractPropertySheetFactory*>(this))) { - connect(ext, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*))); + connect(ext, &QObject::destroyed, this, &QDesignerAbstractPropertySheetFactory::objectDestroyed); it = m_impl->m_extensions.insert(object, ext); } } if (!m_impl->m_extended.contains(object)) { - connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*))); + connect(object, &QObject::destroyed, this, &QDesignerAbstractPropertySheetFactory::objectDestroyed); m_impl->m_extended.insert(object, true); } diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp index 75ff992e..7f40ffb6 100644 --- a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp +++ b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp @@ -69,8 +69,8 @@ QStackedWidgetPreviewEventFilter::QStackedWidgetPreviewEventFilter(QStackedWidge m_prev(createToolButton(m_stackedWidget, Qt::LeftArrow, QStringLiteral("__qt__passive_prev"))), m_next(createToolButton(m_stackedWidget, Qt::RightArrow, QStringLiteral("__qt__passive_next"))) { - connect(m_prev, SIGNAL(clicked()), this, SLOT(prevPage())); - connect(m_next, SIGNAL(clicked()), this, SLOT(nextPage())); + connect(m_prev, &QAbstractButton::clicked, this, &QStackedWidgetPreviewEventFilter::prevPage); + connect(m_next, &QAbstractButton::clicked, this, &QStackedWidgetPreviewEventFilter::nextPage); updateButtons(); m_stackedWidget->installEventFilter(this); @@ -189,12 +189,12 @@ QStackedWidgetEventFilter::QStackedWidgetEventFilter(QStackedWidget *parent) : m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) { setButtonToolTipEnabled(true); - connect(m_actionPreviousPage, SIGNAL(triggered()), this, SLOT(prevPage())); - connect(m_actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage())); - connect(m_actionDeletePage, SIGNAL(triggered()), this, SLOT(removeCurrentPage())); - connect(m_actionInsertPage, SIGNAL(triggered()), this, SLOT(addPage())); - connect(m_actionInsertPageAfter, SIGNAL(triggered()), this, SLOT(addPageAfter())); - connect(m_actionChangePageOrder, SIGNAL(triggered()), this, SLOT(changeOrder())); + connect(m_actionPreviousPage, &QAction::triggered, this, &QStackedWidgetEventFilter::prevPage); + connect(m_actionNextPage, &QAction::triggered, this, &QStackedWidgetEventFilter::nextPage); + connect(m_actionDeletePage, &QAction::triggered, this, &QStackedWidgetEventFilter::removeCurrentPage); + connect(m_actionInsertPage, &QAction::triggered, this, &QStackedWidgetEventFilter::addPage); + connect(m_actionInsertPageAfter, &QAction::triggered, this, &QStackedWidgetEventFilter::addPageAfter); + connect(m_actionChangePageOrder, &QAction::triggered, this, &QStackedWidgetEventFilter::changeOrder); } void QStackedWidgetEventFilter::install(QStackedWidget *stackedWidget) @@ -321,7 +321,7 @@ QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup) insertPageMenu->addAction(m_actionInsertPage); } else { QAction *insertPageAction = popup->addAction(tr("Insert Page")); - connect(insertPageAction, SIGNAL(triggered()), this, SLOT(addPage())); + connect(insertPageAction, &QAction::triggered, this, &QStackedWidgetEventFilter::addPage); } popup->addAction(m_actionNextPage); m_actionNextPage->setEnabled(hasSeveralPages); diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp index 43f933bc..16866380 100644 --- a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp +++ b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp @@ -88,9 +88,9 @@ QTabWidgetEventFilter::QTabWidgetEventFilter(QTabWidget *parent) : tabBar()->setAcceptDrops(true); tabBar()->installEventFilter(this); - connect(m_actionInsertPage, SIGNAL(triggered()), this, SLOT(addPage())); - connect(m_actionInsertPageAfter, SIGNAL(triggered()), this, SLOT(addPageAfter())); - connect(m_actionDeletePage, SIGNAL(triggered()), this, SLOT(removeCurrentPage())); + connect(m_actionInsertPage, &QAction::triggered, this, &QTabWidgetEventFilter::addPage); + connect(m_actionInsertPageAfter, &QAction::triggered, this, &QTabWidgetEventFilter::addPageAfter); + connect(m_actionDeletePage, &QAction::triggered, this, &QTabWidgetEventFilter::removeCurrentPage); } QTabWidgetEventFilter::~QTabWidgetEventFilter() @@ -380,7 +380,7 @@ QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup) insertPageMenu->addAction(m_actionInsertPage); } else { QAction *insertPageAction = popup->addAction(tr("Insert Page")); - connect(insertPageAction, SIGNAL(triggered()), this, SLOT(addPage())); + connect(insertPageAction, &QAction::triggered, this, &QTabWidgetEventFilter::addPage); } popup->addSeparator(); return pageMenu; diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp index 07e6ee69..fad08b1e 100644 --- a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp +++ b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp @@ -159,8 +159,8 @@ ObjectNameDialog::ObjectNameDialog(QWidget *parent, const QString &oldName) okButton->setDefault(true); vboxLayout->addWidget(buttonBox); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } QString ObjectNameDialog::newObjectName() const @@ -386,17 +386,17 @@ QDesignerTaskMenu::QDesignerTaskMenu(QWidget *widget, QObject *parent) : d->m_q = this; Q_ASSERT(qobject_cast<QDesignerFormWindowInterface*>(widget) == 0); - connect(d->m_changeObjectNameAction, SIGNAL(triggered()), this, SLOT(changeObjectName())); - connect(d->m_changeToolTip, SIGNAL(triggered()), this, SLOT(changeToolTip())); - connect(d->m_changeWhatsThis, SIGNAL(triggered()), this, SLOT(changeWhatsThis())); - connect(d->m_changeStyleSheet, SIGNAL(triggered()), this, SLOT(changeStyleSheet())); - connect(d->m_addMenuBar, SIGNAL(triggered()), this, SLOT(createMenuBar())); - connect(d->m_addToolBar, SIGNAL(triggered()), this, SLOT(addToolBar())); - connect(d->m_addStatusBar, SIGNAL(triggered()), this, SLOT(createStatusBar())); - connect(d->m_removeStatusBar, SIGNAL(triggered()), this, SLOT(removeStatusBar())); - connect(d->m_containerFakeMethods, SIGNAL(triggered()), this, SLOT(containerFakeMethods())); - connect(d->m_navigateToSlot, SIGNAL(triggered()), this, SLOT(slotNavigateToSlot())); - connect(d->m_sizeActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(applySize(QAction*))); + connect(d->m_changeObjectNameAction, &QAction::triggered, this, &QDesignerTaskMenu::changeObjectName); + connect(d->m_changeToolTip, &QAction::triggered, this, &QDesignerTaskMenu::changeToolTip); + connect(d->m_changeWhatsThis, &QAction::triggered, this, &QDesignerTaskMenu::changeWhatsThis); + connect(d->m_changeStyleSheet, &QAction::triggered, this, &QDesignerTaskMenu::changeStyleSheet); + connect(d->m_addMenuBar, &QAction::triggered, this, &QDesignerTaskMenu::createMenuBar); + connect(d->m_addToolBar, &QAction::triggered, this, &QDesignerTaskMenu::addToolBar); + connect(d->m_addStatusBar, &QAction::triggered, this, &QDesignerTaskMenu::createStatusBar); + connect(d->m_removeStatusBar, &QAction::triggered, this, &QDesignerTaskMenu::removeStatusBar); + connect(d->m_containerFakeMethods, &QAction::triggered, this, &QDesignerTaskMenu::containerFakeMethods); + connect(d->m_navigateToSlot, &QAction::triggered, this, &QDesignerTaskMenu::slotNavigateToSlot); + connect(d->m_sizeActionGroup, &QActionGroup::triggered, this, &QDesignerTaskMenu::applySize); d->m_layoutAlignmentMenu.connect(this, SLOT(slotLayoutAlignment())); } @@ -723,8 +723,8 @@ void QDesignerTaskMenu::navigateToSlot(QDesignerFormEditorInterface *core, dialogUi.signalList->addTopLevelItem(row); dialogUi.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); } else { - connect(dialogUi.signalList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), - &selectSignalDialog, SLOT(accept())); + connect(dialogUi.signalList, &QTreeWidget::itemDoubleClicked, + &selectSignalDialog, &QDialog::accept); } if (defaultSignal.isEmpty()) { diff --git a/src/designer/src/lib/shared/qdesigner_toolbar.cpp b/src/designer/src/lib/shared/qdesigner_toolbar.cpp index b9dcbbd6..afcc3170 100644 --- a/src/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/src/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -141,7 +141,7 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos) QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), 0); itemData.setValue(action); newSeperatorAct->setData(itemData); - connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator())); + connect(newSeperatorAct, &QAction::triggered, this, &ToolBarEventFilter::slotInsertSeparator); rc.push_back(newSeperatorAct); } @@ -150,7 +150,7 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos) QAction *newSeperatorAct = new QAction(tr("Append Separator"), 0); itemData.setValue(static_cast<QAction*>(0)); newSeperatorAct->setData(itemData); - connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator())); + connect(newSeperatorAct, &QAction::triggered, this, &ToolBarEventFilter::slotInsertSeparator); rc.push_back(newSeperatorAct); } // Promotion @@ -162,12 +162,12 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos) QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), 0); itemData.setValue(action); a->setData(itemData); - connect(a, SIGNAL(triggered()), this, SLOT(slotRemoveSelectedAction())); + connect(a, &QAction::triggered, this, &ToolBarEventFilter::slotRemoveSelectedAction); rc.push_back(a); } QAction *remove_toolbar = new QAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()), 0); - connect(remove_toolbar, SIGNAL(triggered()), this, SLOT(slotRemoveToolBar())); + connect(remove_toolbar, &QAction::triggered, this, &ToolBarEventFilter::slotRemoveToolBar); rc.push_back(remove_toolbar); return rc; } diff --git a/src/designer/src/lib/shared/qdesigner_toolbox.cpp b/src/designer/src/lib/shared/qdesigner_toolbox.cpp index 3d0271b2..29428973 100644 --- a/src/designer/src/lib/shared/qdesigner_toolbox.cpp +++ b/src/designer/src/lib/shared/qdesigner_toolbox.cpp @@ -59,10 +59,10 @@ QToolBoxHelper::QToolBoxHelper(QToolBox *toolbox) : m_actionChangePageOrder(new QAction(tr("Change Page Order..."), this)), m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) { - connect(m_actionDeletePage, SIGNAL(triggered()), this, SLOT(removeCurrentPage())); - connect(m_actionInsertPage, SIGNAL(triggered()), this, SLOT(addPage())); - connect(m_actionInsertPageAfter, SIGNAL(triggered()), this, SLOT(addPageAfter())); - connect(m_actionChangePageOrder, SIGNAL(triggered()), this, SLOT(changeOrder())); + connect(m_actionDeletePage, &QAction::triggered, this, &QToolBoxHelper::removeCurrentPage); + connect(m_actionInsertPage, &QAction::triggered, this, &QToolBoxHelper::addPage); + connect(m_actionInsertPageAfter, &QAction::triggered, this, &QToolBoxHelper::addPageAfter); + connect(m_actionChangePageOrder, &QAction::triggered, this, &QToolBoxHelper::changeOrder); m_toolbox->installEventFilter(this); } diff --git a/src/designer/src/lib/shared/qdesigner_widgetitem.cpp b/src/designer/src/lib/shared/qdesigner_widgetitem.cpp index 00eca753..46b53e4c 100644 --- a/src/designer/src/lib/shared/qdesigner_widgetitem.cpp +++ b/src/designer/src/lib/shared/qdesigner_widgetitem.cpp @@ -121,7 +121,7 @@ QDesignerWidgetItem::QDesignerWidgetItem(const QLayout *containingLayout, QWidge expand(&m_nonLaidOutMinSize); expand(&m_nonLaidOutSizeHint); w->installEventFilter(this); - connect(containingLayout, SIGNAL(destroyed()), this, SLOT(layoutChanged())); + connect(containingLayout, &QObject::destroyed, this, &QDesignerWidgetItem::layoutChanged); if (DebugWidgetItem ) qDebug() << "QDesignerWidgetItem" << w << sizePolicyToString(w->sizePolicy()) << m_nonLaidOutMinSize << m_nonLaidOutSizeHint; } @@ -287,8 +287,10 @@ const QLayout *QDesignerWidgetItem::containingLayout() const if (QWidget *parentWidget = constWidget()->parentWidget()) if (QLayout *parentLayout = parentWidget->layout()) { m_cachedContainingLayout = findLayoutOfItem(parentLayout, this); - if (m_cachedContainingLayout) - connect(m_cachedContainingLayout, SIGNAL(destroyed()), this, SLOT(layoutChanged())); + if (m_cachedContainingLayout) { + connect(m_cachedContainingLayout, &QObject::destroyed, + this, &QDesignerWidgetItem::layoutChanged); + } } if (DebugWidgetItem) qDebug() << Q_FUNC_INFO << " found " << m_cachedContainingLayout << " after reparenting " << constWidget(); diff --git a/src/designer/src/lib/shared/richtexteditor.cpp b/src/designer/src/lib/shared/richtexteditor.cpp index a5f19e13..e8eed095 100644 --- a/src/designer/src/lib/shared/richtexteditor.cpp +++ b/src/designer/src/lib/shared/richtexteditor.cpp @@ -305,8 +305,7 @@ void HtmlTextEdit::contextMenuEvent(QContextMenuEvent *event) } menu->addMenu(htmlMenu); - connect(htmlMenu, SIGNAL(triggered(QAction*)), - SLOT(actionTriggered(QAction*))); + connect(htmlMenu, &QMenu::triggered, this, &HtmlTextEdit::actionTriggered); menu->exec(event->globalPos()); delete menu; } @@ -434,14 +433,16 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core, m_core(core), m_editor(editor) { + typedef void (QComboBox::*QComboStringSignal)(const QString &); + // Font size combo box m_font_size_input->setEditable(false); const QList<int> font_sizes = QFontDatabase::standardSizes(); foreach (int font_size, font_sizes) m_font_size_input->addItem(QString::number(font_size)); - connect(m_font_size_input, SIGNAL(activated(QString)), - this, SLOT(sizeInputActivated(QString))); + connect(m_font_size_input, static_cast<QComboStringSignal>(&QComboBox::activated), + this, &RichTextEditorToolBar::sizeInputActivated); addWidget(m_font_size_input); addSeparator(); @@ -471,8 +472,8 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core, // Left, center, right and justified alignment buttons QActionGroup *alignment_group = new QActionGroup(this); - connect(alignment_group, SIGNAL(triggered(QAction*)), - SLOT(alignmentActionTriggered(QAction*))); + connect(alignment_group, &QActionGroup::triggered, + this, &RichTextEditorToolBar::alignmentActionTriggered); m_align_left_action = createCheckableAction( createIconSet(QStringLiteral("textleft.png")), @@ -521,19 +522,19 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core, m_link_action->setIcon(createIconSet(QStringLiteral("textanchor.png"))); m_link_action->setText(tr("Insert &Link")); - connect(m_link_action, SIGNAL(triggered()), SLOT(insertLink())); + connect(m_link_action, &QAction::triggered, this, &RichTextEditorToolBar::insertLink); addAction(m_link_action); m_image_action->setIcon(createIconSet(QStringLiteral("insertimage.png"))); m_image_action->setText(tr("Insert &Image")); - connect(m_image_action, SIGNAL(triggered()), SLOT(insertImage())); + connect(m_image_action, &QAction::triggered, this, &RichTextEditorToolBar::insertImage); addAction(m_image_action); addSeparator(); // Text color button - connect(m_color_action, SIGNAL(colorChanged(QColor)), - this, SLOT(colorChanged(QColor))); + connect(m_color_action, &ColorAction::colorChanged, + this, &RichTextEditorToolBar::colorChanged); addAction(m_color_action); addSeparator(); @@ -543,12 +544,12 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core, = createCheckableAction(createIconSet(QStringLiteral("simplifyrichtext.png")), tr("Simplify Rich Text"), m_editor, SLOT(setSimplifyRichText(bool))); m_simplify_richtext_action->setChecked(m_editor->simplifyRichText()); - connect(m_editor, SIGNAL(simplifyRichTextChanged(bool)), - m_simplify_richtext_action, SLOT(setChecked(bool))); + connect(m_editor.data(), &RichTextEditor::simplifyRichTextChanged, + m_simplify_richtext_action, &QAction::setChecked); addAction(m_simplify_richtext_action); - connect(editor, SIGNAL(textChanged()), this, SLOT(updateActions())); - connect(editor, SIGNAL(stateChanged()), this, SLOT(updateActions())); + connect(editor, &QTextEdit::textChanged, this, &RichTextEditorToolBar::updateActions); + connect(editor, &RichTextEditor::stateChanged, this, &RichTextEditorToolBar::updateActions); updateActions(); } @@ -683,10 +684,10 @@ void RichTextEditorToolBar::updateActions() RichTextEditor::RichTextEditor(QWidget *parent) : QTextEdit(parent), m_simplifyRichText(simplifyRichTextDefault) { - connect(this, SIGNAL(currentCharFormatChanged(QTextCharFormat)), - this, SIGNAL(stateChanged())); - connect(this, SIGNAL(cursorPositionChanged()), - this, SIGNAL(stateChanged())); + connect(this, &RichTextEditor::currentCharFormatChanged, + this, &RichTextEditor::stateChanged); + connect(this, &RichTextEditor::cursorPositionChanged, + this, &RichTextEditor::stateChanged); } QToolBar *RichTextEditor::createToolBar(QDesignerFormEditorInterface *core, QWidget *parent) @@ -783,9 +784,10 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q m_text_edit->setAcceptRichText(false); new HtmlHighlighter(m_text_edit); - connect(m_editor, SIGNAL(textChanged()), this, SLOT(richTextChanged())); - connect(m_editor, SIGNAL(simplifyRichTextChanged(bool)), this, SLOT(richTextChanged())); - connect(m_text_edit, SIGNAL(textChanged()), this, SLOT(sourceChanged())); + connect(m_editor, &QTextEdit::textChanged, this, &RichTextEditorDialog::richTextChanged); + connect(m_editor, &RichTextEditor::simplifyRichTextChanged, + this, &RichTextEditorDialog::richTextChanged); + connect(m_text_edit, &QTextEdit::textChanged, this, &RichTextEditorDialog::sourceChanged); // The toolbar needs to be created after the RichTextEditor QToolBar *tool_bar = m_editor->createToolBar(core); @@ -803,16 +805,16 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q m_tab_widget->setTabPosition(QTabWidget::South); m_tab_widget->addTab(rich_edit, tr("Rich Text")); m_tab_widget->addTab(plain_edit, tr("Source")); - connect(m_tab_widget, SIGNAL(currentChanged(int)), - SLOT(tabIndexChanged(int))); + connect(m_tab_widget, &QTabWidget::currentChanged, + this, &RichTextEditorDialog::tabIndexChanged); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); QPushButton *ok_button = buttonBox->button(QDialogButtonBox::Ok); ok_button->setText(tr("&OK")); ok_button->setDefault(true); buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel")); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(m_tab_widget); diff --git a/src/designer/src/lib/shared/signalslotdialog.cpp b/src/designer/src/lib/shared/signalslotdialog.cpp index 2e52cc41..e588376f 100644 --- a/src/designer/src/lib/shared/signalslotdialog.cpp +++ b/src/designer/src/lib/shared/signalslotdialog.cpp @@ -254,16 +254,16 @@ SignaturePanel::SignaturePanel(QObject *parent, QListView *listView, QToolButton { m_removeButton->setEnabled(false); - connect(addButton, SIGNAL(clicked()), this, SLOT(slotAdd())); - connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemove())); + connect(addButton, &QAbstractButton::clicked, this, &SignaturePanel::slotAdd); + connect(m_removeButton, &QAbstractButton::clicked, this, &SignaturePanel::slotRemove); m_listView->setModel(m_model); SignatureDelegate *delegate = new SignatureDelegate(this); m_listView->setItemDelegate(delegate); - connect(m_model, SIGNAL(checkSignature(QString,bool*)), this, SIGNAL(checkSignature(QString,bool*))); - - connect(m_listView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(slotSelectionChanged(QItemSelection,QItemSelection))); + connect(m_model, &SignatureModel::checkSignature, + this, &SignaturePanel::checkSignature); + connect(m_listView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &SignaturePanel::slotSelectionChanged); } void SignaturePanel::slotAdd() @@ -366,11 +366,13 @@ SignalSlotDialog::SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidg m_slotPanel = new SignaturePanel(this, m_ui->slotListView, m_ui->addSlotButton, m_ui->removeSlotButton, QStringLiteral("slot")); m_signalPanel = new SignaturePanel(this, m_ui->signalListView, m_ui->addSignalButton, m_ui->removeSignalButton, QStringLiteral("signal")); - connect(m_slotPanel, SIGNAL(checkSignature(QString,bool*)), this, SLOT(slotCheckSignature(QString,bool*))); - connect(m_signalPanel, SIGNAL(checkSignature(QString,bool*)), this, SLOT(slotCheckSignature(QString,bool*))); + connect(m_slotPanel, &SignaturePanel::checkSignature, + this, &SignalSlotDialog::slotCheckSignature); + connect(m_signalPanel, &SignaturePanel::checkSignature, + this, &SignalSlotDialog::slotCheckSignature); - connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); switch(m_focusMode) { case FocusSlots: diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp index 108f73cb..25df6bce 100644 --- a/src/designer/src/lib/shared/stylesheeteditor.cpp +++ b/src/designer/src/lib/shared/stylesheeteditor.cpp @@ -87,15 +87,19 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor m_addColorAction(new QAction(tr("Add Color..."), this)), m_addFontAction(new QAction(tr("Add Font..."), this)) { + typedef void (QSignalMapper::*MapperVoidSlot)(); + typedef void (QSignalMapper::*MapperQStringSignal)(const QString &); + setWindowTitle(tr("Edit Style Sheet")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - connect(m_buttonBox, SIGNAL(helpRequested()), this, SLOT(slotRequestHelp())); + connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + connect(m_buttonBox, &QDialogButtonBox::helpRequested, + this, &StyleSheetEditorDialog::slotRequestHelp); m_buttonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); - connect(m_editor, SIGNAL(textChanged()), this, SLOT(validateStyleSheet())); + connect(m_editor, &QTextEdit::textChanged, this, &StyleSheetEditorDialog::validateStyleSheet); QToolBar *toolBar = new QToolBar; @@ -107,8 +111,8 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor setLayout(layout); m_editor->setContextMenuPolicy(Qt::CustomContextMenu); - connect(m_editor, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(slotContextMenuRequested(QPoint))); + connect(m_editor, &QWidget::customContextMenuRequested, + this, &StyleSheetEditorDialog::slotContextMenuRequested); QSignalMapper *resourceActionMapper = new QSignalMapper(this); QSignalMapper *gradientActionMapper = new QSignalMapper(this); @@ -118,10 +122,13 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor gradientActionMapper->setMapping(m_addGradientAction, QString()); colorActionMapper->setMapping(m_addColorAction, QString()); - connect(m_addResourceAction, SIGNAL(triggered()), resourceActionMapper, SLOT(map())); - connect(m_addGradientAction, SIGNAL(triggered()), gradientActionMapper, SLOT(map())); - connect(m_addColorAction, SIGNAL(triggered()), colorActionMapper, SLOT(map())); - connect(m_addFontAction, SIGNAL(triggered()), this, SLOT(slotAddFont())); + connect(m_addResourceAction, &QAction::triggered, + resourceActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + connect(m_addGradientAction, &QAction::triggered, + gradientActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + connect(m_addColorAction, &QAction::triggered, + colorActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + connect(m_addFontAction, &QAction::triggered, this, &StyleSheetEditorDialog::slotAddFont); m_addResourceAction->setEnabled(mode == ModePerForm); @@ -153,22 +160,28 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor for (int resourceProperty = 0; resourceProperties[resourceProperty]; ++resourceProperty) { QAction *action = resourceActionMenu->addAction(QLatin1String(resourceProperties[resourceProperty])); - connect(action, SIGNAL(triggered()), resourceActionMapper, SLOT(map())); + connect(action, &QAction::triggered, + resourceActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); resourceActionMapper->setMapping(action, QLatin1String(resourceProperties[resourceProperty])); } for (int colorProperty = 0; colorProperties[colorProperty]; ++colorProperty) { QAction *gradientAction = gradientActionMenu->addAction(QLatin1String(colorProperties[colorProperty])); QAction *colorAction = colorActionMenu->addAction(QLatin1String(colorProperties[colorProperty])); - connect(gradientAction, SIGNAL(triggered()), gradientActionMapper, SLOT(map())); - connect(colorAction, SIGNAL(triggered()), colorActionMapper, SLOT(map())); + connect(gradientAction, &QAction::triggered, + gradientActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + connect(colorAction, &QAction::triggered, + colorActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); gradientActionMapper->setMapping(gradientAction, QLatin1String(colorProperties[colorProperty])); colorActionMapper->setMapping(colorAction, QLatin1String(colorProperties[colorProperty])); } - connect(resourceActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddResource(QString))); - connect(gradientActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddGradient(QString))); - connect(colorActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddColor(QString))); + connect(resourceActionMapper, static_cast<MapperQStringSignal>(&QSignalMapper::mapped), + this, &StyleSheetEditorDialog::slotAddResource); + connect(gradientActionMapper, static_cast<MapperQStringSignal>(&QSignalMapper::mapped), + this, &StyleSheetEditorDialog::slotAddGradient); + connect(colorActionMapper, static_cast<MapperQStringSignal>(&QSignalMapper::mapped), + this, &StyleSheetEditorDialog::slotAddColor); m_addResourceAction->setMenu(resourceActionMenu); m_addGradientAction->setMenu(gradientActionMenu); @@ -379,8 +392,10 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent, Q_ASSERT(m_fw != 0); QPushButton *apply = buttonBox()->addButton(QDialogButtonBox::Apply); - QObject::connect(apply, SIGNAL(clicked()), this, SLOT(applyStyleSheet())); - QObject::connect(buttonBox(), SIGNAL(accepted()), this, SLOT(applyStyleSheet())); + QObject::connect(apply, &QAbstractButton::clicked, + this, &StyleSheetPropertyEditorDialog::applyStyleSheet); + QObject::connect(buttonBox(), &QDialogButtonBox::accepted, + this, &StyleSheetPropertyEditorDialog::applyStyleSheet); QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget); diff --git a/src/designer/src/lib/shared/textpropertyeditor.cpp b/src/designer/src/lib/shared/textpropertyeditor.cpp index 92a4a9be..0adc506b 100644 --- a/src/designer/src/lib/shared/textpropertyeditor.cpp +++ b/src/designer/src/lib/shared/textpropertyeditor.cpp @@ -227,10 +227,10 @@ namespace qdesigner_internal { setFocusProxy(m_lineEdit); - connect(m_lineEdit,SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); - connect(m_lineEdit,SIGNAL(returnPressed()), this, SLOT(slotEditingFinished())); - connect(m_lineEdit,SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString))); - connect(m_lineEdit,SIGNAL(textEdited(QString)), this, SLOT(slotTextEdited())); + connect(m_lineEdit,&QLineEdit::editingFinished, this, &TextPropertyEditor::editingFinished); + connect(m_lineEdit,&QLineEdit::returnPressed, this, &TextPropertyEditor::slotEditingFinished); + connect(m_lineEdit,&QLineEdit::textChanged, this, &TextPropertyEditor::slotTextChanged); + connect(m_lineEdit,&QLineEdit::textEdited, this, &TextPropertyEditor::slotTextEdited); setTextPropertyValidationMode(validationMode); } diff --git a/src/designer/src/lib/shared/widgetfactory.cpp b/src/designer/src/lib/shared/widgetfactory.cpp index 089e239e..085b2a48 100644 --- a/src/designer/src/lib/shared/widgetfactory.cpp +++ b/src/designer/src/lib/shared/widgetfactory.cpp @@ -138,7 +138,7 @@ public slots: WizardPageChangeWatcher::WizardPageChangeWatcher(QWizard *parent) : QObject(parent) { - connect(parent, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged())); + connect(parent, &QWizard::currentIdChanged, this, &WizardPageChangeWatcher::pageChanged); } void WizardPageChangeWatcher::pageChanged() diff --git a/src/designer/src/lib/shared/widgetfactory_p.h b/src/designer/src/lib/shared/widgetfactory_p.h index eabff099..2aa949b7 100644 --- a/src/designer/src/lib/shared/widgetfactory_p.h +++ b/src/designer/src/lib/shared/widgetfactory_p.h @@ -121,8 +121,6 @@ public: public slots: void loadPlugins(); - -private slots: void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow); void formWindowAdded(QDesignerFormWindowInterface *formWindow); diff --git a/src/designer/src/lib/shared/zoomwidget.cpp b/src/designer/src/lib/shared/zoomwidget.cpp index ee55d7fc..2853be50 100644 --- a/src/designer/src/lib/shared/zoomwidget.cpp +++ b/src/designer/src/lib/shared/zoomwidget.cpp @@ -63,7 +63,7 @@ ZoomMenu::ZoomMenu(QObject *parent) : QObject(parent), m_menuActions(new QActionGroup(this)) { - connect(m_menuActions, SIGNAL(triggered(QAction*)), this, SLOT(slotZoomMenu(QAction*))); + connect(m_menuActions, &QActionGroup::triggered, this, &ZoomMenu::slotZoomMenu); const int nz = sizeof(menuZoomList)/sizeof(int); for (int i = 0; i < nz; i++) { const int zoom = menuZoomList[i]; @@ -201,7 +201,7 @@ ZoomMenu *ZoomView::zoomMenu() if (!m_zoomMenu) { m_zoomMenu = new ZoomMenu(this); m_zoomMenu->setZoom(m_zoom); - connect(m_zoomMenu, SIGNAL(zoomChanged(int)), this, SLOT(setZoom(int))); + connect(m_zoomMenu, &ZoomMenu::zoomChanged, this, &ZoomView::setZoom); } return m_zoomMenu; } @@ -222,11 +222,6 @@ void ZoomView::showContextMenu(const QPoint &globalPos) { QMenu menu; zoomMenu()->addActions(&menu); - if (debugZoomWidget) { - menu.addSeparator(); - QAction *da = menu.addAction(QStringLiteral("Dump")); - connect(da, SIGNAL(triggered()), this, SLOT(dump())); - } menu.exec(globalPos); } diff --git a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp index 2c195b4c..53a222dd 100644 --- a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp +++ b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp @@ -95,7 +95,7 @@ bool QAxWidgetPropertySheet::reset(int index) if (name != m_controlProperty) return QDesignerPropertySheet::reset(index); axWidget()->resetControl(); - QTimer::singleShot(0, this, SLOT(updatePropertySheet())); + QTimer::singleShot(0, this, &QAxWidgetPropertySheet::updatePropertySheet); return true; } @@ -124,7 +124,7 @@ void QAxWidgetPropertySheet::setProperty(int index, const QVariant &value) if (clsid.isEmpty() || !axWidget()->loadControl(clsid)) reset(index); else - QTimer::singleShot(100, this, SLOT(updatePropertySheet())); + QTimer::singleShot(100, this, &QAxWidgetPropertySheet::updatePropertySheet); } } diff --git a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp index 712bee52..fd5f170f 100644 --- a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp +++ b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp @@ -113,8 +113,8 @@ QAxWidgetTaskMenu::QAxWidgetTaskMenu(QDesignerAxWidget *object, QObject *parent) m_setAction(new QAction(tr("Set Control"), this)), m_resetAction(new QAction(tr("Reset Control"), this)) { - connect(m_setAction, SIGNAL(triggered()), this, SLOT(setActiveXControl())); - connect(m_resetAction, SIGNAL(triggered()), this, SLOT(resetActiveXControl())); + connect(m_setAction, &QAction::triggered, this, &QAxWidgetTaskMenu::setActiveXControl); + connect(m_resetAction, &QAction::triggered, this, &QAxWidgetTaskMenu::resetActiveXControl); m_taskActions.push_back(m_setAction); m_taskActions.push_back(m_resetAction); } diff --git a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp index 7cfb9002..9e54f1d2 100644 --- a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp +++ b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp @@ -86,8 +86,8 @@ bool QQuickWidgetPlugin::isContainer() const QWidget *QQuickWidgetPlugin::createWidget(QWidget *parent) { QQuickWidget *result = new QQuickWidget(parent); - connect(result, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)), - this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString))); + connect(result, &QQuickWidget::sceneGraphError, + this, &QQuickWidgetPlugin::sceneGraphError); return result; } diff --git a/src/linguist/linguist/formpreviewview.cpp b/src/linguist/linguist/formpreviewview.cpp index 3a978a68..c73a2366 100644 --- a/src/linguist/linguist/formpreviewview.cpp +++ b/src/linguist/linguist/formpreviewview.cpp @@ -48,6 +48,8 @@ #include <QtWidgets/QMdiArea> #include <QtWidgets/QMdiSubWindow> #include <QtWidgets/QMenu> +#include <QtWidgets/QStackedLayout> +#include <QtWidgets/QStackedWidget> #include <QtWidgets/QTableWidget> #include <QtWidgets/QTabWidget> #include <QtWidgets/QToolBox> @@ -392,8 +394,26 @@ static void highlightWidget(QWidget *w, bool on) highlightAction(m->menuAction(), on); } +static void bringToFront(const TranslatableEntry &target) +{ + for (QObject *obj = target.target.object; obj != 0; obj = obj->parent()) { + if (QWidget *w = qobject_cast<QWidget *>(obj)) { + if (QStackedLayout *lay = qobject_cast<QStackedLayout *>(w->layout())) + lay->setCurrentWidget(w); +#ifndef QT_NO_STACKEDWIDGET + if (QStackedWidget *stack = qobject_cast<QStackedWidget *>(obj->parent())) + stack->setCurrentWidget(w); +#endif +#ifndef QT_NO_TABWIDGET + if (QTabWidget *tab = qobject_cast<QTabWidget *>(obj->parent())) + tab->setCurrentWidget(w); +#endif + } + } +} static void highlightTarget(const TranslatableEntry &target, bool on) { + bringToFront(target); switch (target.type) { case TranslatableProperty: if (QAction *a = qobject_cast<QAction *>(target.target.object)) { diff --git a/src/qtpaths/qtpaths.cpp b/src/qtpaths/qtpaths.cpp index 320ab966..a45064cc 100644 --- a/src/qtpaths/qtpaths.cpp +++ b/src/qtpaths/qtpaths.cpp @@ -77,6 +77,7 @@ static const struct StringEnum { const char *stringvalue; QStandardPaths::StandardLocation enumvalue; } lookupTableData[] = { + { "ApplicationsLocation", QStandardPaths::ApplicationsLocation }, { "DesktopLocation", QStandardPaths::DesktopLocation }, { "DocumentsLocation", QStandardPaths::DocumentsLocation }, { "FontsLocation", QStandardPaths::FontsLocation }, |