aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-06-02 09:14:40 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-06-02 09:54:08 +0000
commit9572b6f7397181be0056689de010d64959cac2aa (patch)
treec4796b6fc295cc8505b4b6e672e6822d609b321a
parent17aaf043099cbf2405a3a667879448ba80dea4b4 (diff)
Qt Designer plugin: Port to new signals & slots syntax.
Split ResourceHandler::updateResources(bool updateProjectResources) into 2 slots to make it compatible to void signals. Change-Id: I0614637cd575c45f9acd6514fe04fe08dfcfcff8 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r--src/plugins/designer/cpp/formclasswizardpage.cpp2
-rw-r--r--src/plugins/designer/formeditorstack.cpp16
-rw-r--r--src/plugins/designer/formeditorw.cpp13
-rw-r--r--src/plugins/designer/formwindowfile.cpp16
-rw-r--r--src/plugins/designer/qtcreatorintegration.cpp4
-rw-r--r--src/plugins/designer/resourcehandler.cpp10
-rw-r--r--src/plugins/designer/resourcehandler.h5
-rw-r--r--src/shared/designerintegrationv2/formresizer.cpp4
-rw-r--r--src/shared/designerintegrationv2/widgethost.cpp4
9 files changed, 40 insertions, 34 deletions
diff --git a/src/plugins/designer/cpp/formclasswizardpage.cpp b/src/plugins/designer/cpp/formclasswizardpage.cpp
index bf26dedfd2..804d967bf8 100644
--- a/src/plugins/designer/cpp/formclasswizardpage.cpp
+++ b/src/plugins/designer/cpp/formclasswizardpage.cpp
@@ -59,7 +59,7 @@ FormClassWizardPage::FormClassWizardPage(QWidget * parent) :
m_ui->newClassWidget->setAllowDirectories(true);
m_ui->newClassWidget->setClassTypeComboVisible(false);
- connect(m_ui->newClassWidget, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
+ connect(m_ui->newClassWidget, &Utils::NewClassWidget::validChanged, this, &FormClassWizardPage::slotValidChanged);
initFileGenerationSettings();
diff --git a/src/plugins/designer/formeditorstack.cpp b/src/plugins/designer/formeditorstack.cpp
index 407fb36791..63a0e3b683 100644
--- a/src/plugins/designer/formeditorstack.cpp
+++ b/src/plugins/designer/formeditorstack.cpp
@@ -63,10 +63,10 @@ void FormEditorStack::add(const EditorData &data)
{
if (m_designerCore == 0) { // Initialize first time here
m_designerCore = data.widgetHost->formWindow()->core();
- connect(m_designerCore->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
- this, SLOT(updateFormWindowSelectionHandles()));
- connect(Core::ModeManager::instance(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
- this, SLOT(modeAboutToChange(Core::IMode*)));
+ connect(m_designerCore->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged,
+ this, &FormEditorStack::updateFormWindowSelectionHandles);
+ connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeAboutToChange,
+ this, &FormEditorStack::modeAboutToChange);
}
if (Designer::Constants::Internal::debug)
@@ -77,11 +77,11 @@ void FormEditorStack::add(const EditorData &data)
// Editors are normally removed by listening to EditorManager::editorsClosed.
// However, in the case opening a file fails, EditorManager just deletes the editor, which
// is caught by the destroyed() signal.
- connect(data.formWindowEditor, SIGNAL(destroyed(QObject*)),
- this, SLOT(removeFormWindowEditor(QObject*)));
+ connect(data.formWindowEditor, &FormWindowEditor::destroyed,
+ this, &FormEditorStack::removeFormWindowEditor);
- connect(data.widgetHost, SIGNAL(formWindowSizeChanged(int,int)),
- this, SLOT(formSizeChanged(int,int)));
+ connect(data.widgetHost, &SharedTools::WidgetHost::formWindowSizeChanged,
+ this, &FormEditorStack::formSizeChanged);
if (Designer::Constants::Internal::debug)
qDebug() << "FormEditorStack::add" << data.widgetHost << m_formEditors.size();
diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp
index c46de4b52f..d1ac199e04 100644
--- a/src/plugins/designer/formeditorw.cpp
+++ b/src/plugins/designer/formeditorw.cpp
@@ -196,7 +196,7 @@ public:
public:
QDesignerFormEditorInterface *m_formeditor;
- QDesignerIntegrationInterface *m_integration;
+ QtCreatorIntegration *m_integration;
QDesignerFormWindowManagerInterface *m_fwm;
FormEditorW::InitializationStage m_initStage;
@@ -386,8 +386,9 @@ void FormEditorData::fullInit()
m_integration = new QtCreatorIntegration(m_formeditor, m_instance);
m_formeditor->setIntegration(m_integration);
// Connect Qt Designer help request to HelpManager.
- QObject::connect(m_integration, SIGNAL(creatorHelpRequested(QUrl)),
- HelpManager::instance(), SLOT(handleHelpRequest(QUrl)));
+ QObject::connect(m_integration, &QtCreatorIntegration::creatorHelpRequested,
+ HelpManager::instance(),
+ [](const QUrl &url) { HelpManager::instance()->handleHelpRequest(url, HelpManager::HelpModeAlways); });
/**
* This will initialize our TabOrder, Signals and slots and Buddy editors.
@@ -740,9 +741,11 @@ void FormEditorData::critical(const QString &errorMessage)
// Apply the command shortcut to the action and connects to the command's keySequenceChanged signal
void FormEditorData::bindShortcut(Command *command, QAction *action)
{
+ typedef void (QSignalMapper::*SignalMapperVoidSlot)();
+
m_commandToDesignerAction.insert(command, action);
- QObject::connect(command, SIGNAL(keySequenceChanged()),
- &m_shortcutMapper, SLOT(map()));
+ QObject::connect(command, &Command::keySequenceChanged,
+ &m_shortcutMapper, static_cast<SignalMapperVoidSlot>(&QSignalMapper::map));
m_shortcutMapper.setMapping(command, command);
updateShortcut(command);
}
diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp
index 4b2ec88039..dd168cd85f 100644
--- a/src/plugins/designer/formwindowfile.cpp
+++ b/src/plugins/designer/formwindowfile.cpp
@@ -61,15 +61,15 @@ FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *pare
setId(Core::Id(Designer::Constants::K_DESIGNER_XML_EDITOR_ID));
// Designer needs UTF-8 regardless of settings.
setCodec(QTextCodec::codecForName("UTF-8"));
- connect(m_formWindow->core()->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)),
- this, SLOT(slotFormWindowRemoved(QDesignerFormWindowInterface*)));
- connect(m_formWindow->commandHistory(), SIGNAL(indexChanged(int)),
- this, SLOT(setShouldAutoSave()));
- connect(m_formWindow, SIGNAL(changed()), SLOT(updateIsModified()));
+ connect(m_formWindow->core()->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowRemoved,
+ this, &FormWindowFile::slotFormWindowRemoved);
+ connect(m_formWindow->commandHistory(), &QUndoStack::indexChanged,
+ this, &FormWindowFile::setShouldAutoSave);
+ connect(m_formWindow.data(), &QDesignerFormWindowInterface::changed, this, &FormWindowFile::updateIsModified);
m_resourceHandler = new ResourceHandler(form);
- connect(this, SIGNAL(filePathChanged(Utils::FileName,Utils::FileName)),
- m_resourceHandler, SLOT(updateResources()));
+ connect(this, &FormWindowFile::filePathChanged,
+ m_resourceHandler, &ResourceHandler::updateResources);
}
bool FormWindowFile::open(QString *errorString, const QString &fileName, const QString &realFileName)
@@ -102,7 +102,7 @@ bool FormWindowFile::open(QString *errorString, const QString &fileName, const Q
syncXmlFromFormWindow();
setFilePath(Utils::FileName::fromString(absfileName));
setShouldAutoSave(false);
- resourceHandler()->updateResources(true);
+ resourceHandler()->updateProjectResources();
return true;
}
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index c62f50d8d0..bd200bd5cf 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -97,8 +97,8 @@ QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, Q
connect(this, &QtCreatorIntegration::helpRequested,
this, &QtCreatorIntegration::slotDesignerHelpRequested);
slotSyncSettingsToDesigner();
- connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()),
- this, SLOT(slotSyncSettingsToDesigner()));
+ connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
+ this, &QtCreatorIntegration::slotSyncSettingsToDesigner);
}
void QtCreatorIntegration::slotDesignerHelpRequested(const QString &manual, const QString &document)
diff --git a/src/plugins/designer/resourcehandler.cpp b/src/plugins/designer/resourcehandler.cpp
index de0e4c8b48..be673f0e8a 100644
--- a/src/plugins/designer/resourcehandler.cpp
+++ b/src/plugins/designer/resourcehandler.cpp
@@ -97,10 +97,10 @@ void ResourceHandler::ensureInitialized()
m_initialized = true;
ProjectTree *tree = ProjectTree::instance();
- connect(tree, SIGNAL(filesAdded()), this, SLOT(updateResources()));
- connect(tree, SIGNAL(filesRemoved()), this, SLOT(updateResources()));
- connect(tree, SIGNAL(foldersAdded()), this, SLOT(updateResources()));
- connect(tree, SIGNAL(foldersRemoved()), this, SLOT(updateResources()));
+ connect(tree, &ProjectTree::filesAdded, this, &ResourceHandler::updateResources);
+ connect(tree, &ProjectTree::filesRemoved, this, &ResourceHandler::updateResources);
+ connect(tree, &ProjectTree::foldersAdded, this, &ResourceHandler::updateResources);
+ connect(tree, &ProjectTree::foldersRemoved, this, &ResourceHandler::updateResources);
m_originalUiQrcPaths = m_form->activeResourceFilePaths();
if (Designer::Constants::Internal::debug)
qDebug() << "ResourceHandler::ensureInitialized() origPaths=" << m_originalUiQrcPaths;
@@ -111,7 +111,7 @@ ResourceHandler::~ResourceHandler()
}
-void ResourceHandler::updateResources(bool updateProjectResources)
+void ResourceHandler::updateResourcesHelper(bool updateProjectResources)
{
if (m_handlingResources)
return;
diff --git a/src/plugins/designer/resourcehandler.h b/src/plugins/designer/resourcehandler.h
index 4e6db675e6..7cdd1d1cb4 100644
--- a/src/plugins/designer/resourcehandler.h
+++ b/src/plugins/designer/resourcehandler.h
@@ -61,10 +61,13 @@ public:
virtual ~ResourceHandler();
public slots:
- void updateResources(bool updateProjectResources = false);
+ void updateResources() { updateResourcesHelper(false); }
+ void updateProjectResources() { updateResourcesHelper(true); }
private:
void ensureInitialized();
+ void updateResourcesHelper(bool updateProjectResources);
+
QDesignerFormWindowInterface * const m_form;
QStringList m_originalUiQrcPaths;
bool m_initialized;
diff --git a/src/shared/designerintegrationv2/formresizer.cpp b/src/shared/designerintegrationv2/formresizer.cpp
index 7a07e2414f..2ca3a7729a 100644
--- a/src/shared/designerintegrationv2/formresizer.cpp
+++ b/src/shared/designerintegrationv2/formresizer.cpp
@@ -65,7 +65,7 @@ FormResizer::FormResizer(QWidget *parent) :
m_handles.reserve(SizeHandleRect::Left);
for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) {
SizeHandleRect *shr = new SizeHandleRect(this, static_cast<SizeHandleRect::Direction>(i), this);
- connect(shr, SIGNAL(mouseButtonReleased(QRect,QRect)), this, SIGNAL(formWindowSizeChanged(QRect,QRect)));
+ connect(shr, &SizeHandleRect::mouseButtonReleased, this, &FormResizer::formWindowSizeChanged);
m_handles.push_back(shr);
}
setState(SelectionHandleActive);
@@ -147,7 +147,7 @@ void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
if (m_formWindow)
layout->addWidget(m_formWindow);
mainContainerChanged();
- connect(fw, SIGNAL(mainContainerChanged(QWidget*)), this, SLOT(mainContainerChanged()));
+ connect(fw, &QDesignerFormWindowInterface::mainContainerChanged, this, &FormResizer::mainContainerChanged);
}
void FormResizer::resizeEvent(QResizeEvent *event)
diff --git a/src/shared/designerintegrationv2/widgethost.cpp b/src/shared/designerintegrationv2/widgethost.cpp
index c965c439f8..017a4f0c2a 100644
--- a/src/shared/designerintegrationv2/widgethost.cpp
+++ b/src/shared/designerintegrationv2/widgethost.cpp
@@ -73,8 +73,8 @@ void WidgetHost::setFormWindow(QDesignerFormWindowInterface *fw)
m_formWindow->setAutoFillBackground(true);
m_formWindow->setBackgroundRole(QPalette::Background);
- connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect,QRect)),
- this, SLOT(fwSizeWasChanged(QRect,QRect)));
+ connect(m_formResizer, &Internal::FormResizer::formWindowSizeChanged,
+ this, &WidgetHost::fwSizeWasChanged);
}
QSize WidgetHost::formWindowSize() const