Commit 9572b6f7 authored by Friedemann Kleint's avatar Friedemann Kleint

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: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 17aaf043
......@@ -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();
......
......@@ -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();
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment