forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -59,7 +59,7 @@ FormClassWizardPage::FormClassWizardPage(QWidget * parent) :
|
|||||||
m_ui->newClassWidget->setAllowDirectories(true);
|
m_ui->newClassWidget->setAllowDirectories(true);
|
||||||
m_ui->newClassWidget->setClassTypeComboVisible(false);
|
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();
|
initFileGenerationSettings();
|
||||||
|
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ void FormEditorStack::add(const EditorData &data)
|
|||||||
{
|
{
|
||||||
if (m_designerCore == 0) { // Initialize first time here
|
if (m_designerCore == 0) { // Initialize first time here
|
||||||
m_designerCore = data.widgetHost->formWindow()->core();
|
m_designerCore = data.widgetHost->formWindow()->core();
|
||||||
connect(m_designerCore->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
|
connect(m_designerCore->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged,
|
||||||
this, SLOT(updateFormWindowSelectionHandles()));
|
this, &FormEditorStack::updateFormWindowSelectionHandles);
|
||||||
connect(Core::ModeManager::instance(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
|
connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeAboutToChange,
|
||||||
this, SLOT(modeAboutToChange(Core::IMode*)));
|
this, &FormEditorStack::modeAboutToChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
@@ -77,11 +77,11 @@ void FormEditorStack::add(const EditorData &data)
|
|||||||
// Editors are normally removed by listening to EditorManager::editorsClosed.
|
// Editors are normally removed by listening to EditorManager::editorsClosed.
|
||||||
// However, in the case opening a file fails, EditorManager just deletes the editor, which
|
// However, in the case opening a file fails, EditorManager just deletes the editor, which
|
||||||
// is caught by the destroyed() signal.
|
// is caught by the destroyed() signal.
|
||||||
connect(data.formWindowEditor, SIGNAL(destroyed(QObject*)),
|
connect(data.formWindowEditor, &FormWindowEditor::destroyed,
|
||||||
this, SLOT(removeFormWindowEditor(QObject*)));
|
this, &FormEditorStack::removeFormWindowEditor);
|
||||||
|
|
||||||
connect(data.widgetHost, SIGNAL(formWindowSizeChanged(int,int)),
|
connect(data.widgetHost, &SharedTools::WidgetHost::formWindowSizeChanged,
|
||||||
this, SLOT(formSizeChanged(int,int)));
|
this, &FormEditorStack::formSizeChanged);
|
||||||
|
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << "FormEditorStack::add" << data.widgetHost << m_formEditors.size();
|
qDebug() << "FormEditorStack::add" << data.widgetHost << m_formEditors.size();
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QDesignerFormEditorInterface *m_formeditor;
|
QDesignerFormEditorInterface *m_formeditor;
|
||||||
QDesignerIntegrationInterface *m_integration;
|
QtCreatorIntegration *m_integration;
|
||||||
QDesignerFormWindowManagerInterface *m_fwm;
|
QDesignerFormWindowManagerInterface *m_fwm;
|
||||||
FormEditorW::InitializationStage m_initStage;
|
FormEditorW::InitializationStage m_initStage;
|
||||||
|
|
||||||
@@ -386,8 +386,9 @@ void FormEditorData::fullInit()
|
|||||||
m_integration = new QtCreatorIntegration(m_formeditor, m_instance);
|
m_integration = new QtCreatorIntegration(m_formeditor, m_instance);
|
||||||
m_formeditor->setIntegration(m_integration);
|
m_formeditor->setIntegration(m_integration);
|
||||||
// Connect Qt Designer help request to HelpManager.
|
// Connect Qt Designer help request to HelpManager.
|
||||||
QObject::connect(m_integration, SIGNAL(creatorHelpRequested(QUrl)),
|
QObject::connect(m_integration, &QtCreatorIntegration::creatorHelpRequested,
|
||||||
HelpManager::instance(), SLOT(handleHelpRequest(QUrl)));
|
HelpManager::instance(),
|
||||||
|
[](const QUrl &url) { HelpManager::instance()->handleHelpRequest(url, HelpManager::HelpModeAlways); });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will initialize our TabOrder, Signals and slots and Buddy editors.
|
* 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
|
// Apply the command shortcut to the action and connects to the command's keySequenceChanged signal
|
||||||
void FormEditorData::bindShortcut(Command *command, QAction *action)
|
void FormEditorData::bindShortcut(Command *command, QAction *action)
|
||||||
{
|
{
|
||||||
|
typedef void (QSignalMapper::*SignalMapperVoidSlot)();
|
||||||
|
|
||||||
m_commandToDesignerAction.insert(command, action);
|
m_commandToDesignerAction.insert(command, action);
|
||||||
QObject::connect(command, SIGNAL(keySequenceChanged()),
|
QObject::connect(command, &Command::keySequenceChanged,
|
||||||
&m_shortcutMapper, SLOT(map()));
|
&m_shortcutMapper, static_cast<SignalMapperVoidSlot>(&QSignalMapper::map));
|
||||||
m_shortcutMapper.setMapping(command, command);
|
m_shortcutMapper.setMapping(command, command);
|
||||||
updateShortcut(command);
|
updateShortcut(command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,15 +61,15 @@ FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *pare
|
|||||||
setId(Core::Id(Designer::Constants::K_DESIGNER_XML_EDITOR_ID));
|
setId(Core::Id(Designer::Constants::K_DESIGNER_XML_EDITOR_ID));
|
||||||
// Designer needs UTF-8 regardless of settings.
|
// Designer needs UTF-8 regardless of settings.
|
||||||
setCodec(QTextCodec::codecForName("UTF-8"));
|
setCodec(QTextCodec::codecForName("UTF-8"));
|
||||||
connect(m_formWindow->core()->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)),
|
connect(m_formWindow->core()->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowRemoved,
|
||||||
this, SLOT(slotFormWindowRemoved(QDesignerFormWindowInterface*)));
|
this, &FormWindowFile::slotFormWindowRemoved);
|
||||||
connect(m_formWindow->commandHistory(), SIGNAL(indexChanged(int)),
|
connect(m_formWindow->commandHistory(), &QUndoStack::indexChanged,
|
||||||
this, SLOT(setShouldAutoSave()));
|
this, &FormWindowFile::setShouldAutoSave);
|
||||||
connect(m_formWindow, SIGNAL(changed()), SLOT(updateIsModified()));
|
connect(m_formWindow.data(), &QDesignerFormWindowInterface::changed, this, &FormWindowFile::updateIsModified);
|
||||||
|
|
||||||
m_resourceHandler = new ResourceHandler(form);
|
m_resourceHandler = new ResourceHandler(form);
|
||||||
connect(this, SIGNAL(filePathChanged(Utils::FileName,Utils::FileName)),
|
connect(this, &FormWindowFile::filePathChanged,
|
||||||
m_resourceHandler, SLOT(updateResources()));
|
m_resourceHandler, &ResourceHandler::updateResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FormWindowFile::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
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();
|
syncXmlFromFormWindow();
|
||||||
setFilePath(Utils::FileName::fromString(absfileName));
|
setFilePath(Utils::FileName::fromString(absfileName));
|
||||||
setShouldAutoSave(false);
|
setShouldAutoSave(false);
|
||||||
resourceHandler()->updateResources(true);
|
resourceHandler()->updateProjectResources();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ QtCreatorIntegration::QtCreatorIntegration(QDesignerFormEditorInterface *core, Q
|
|||||||
connect(this, &QtCreatorIntegration::helpRequested,
|
connect(this, &QtCreatorIntegration::helpRequested,
|
||||||
this, &QtCreatorIntegration::slotDesignerHelpRequested);
|
this, &QtCreatorIntegration::slotDesignerHelpRequested);
|
||||||
slotSyncSettingsToDesigner();
|
slotSyncSettingsToDesigner();
|
||||||
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()),
|
connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
|
||||||
this, SLOT(slotSyncSettingsToDesigner()));
|
this, &QtCreatorIntegration::slotSyncSettingsToDesigner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtCreatorIntegration::slotDesignerHelpRequested(const QString &manual, const QString &document)
|
void QtCreatorIntegration::slotDesignerHelpRequested(const QString &manual, const QString &document)
|
||||||
|
|||||||
@@ -97,10 +97,10 @@ void ResourceHandler::ensureInitialized()
|
|||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
ProjectTree *tree = ProjectTree::instance();
|
ProjectTree *tree = ProjectTree::instance();
|
||||||
|
|
||||||
connect(tree, SIGNAL(filesAdded()), this, SLOT(updateResources()));
|
connect(tree, &ProjectTree::filesAdded, this, &ResourceHandler::updateResources);
|
||||||
connect(tree, SIGNAL(filesRemoved()), this, SLOT(updateResources()));
|
connect(tree, &ProjectTree::filesRemoved, this, &ResourceHandler::updateResources);
|
||||||
connect(tree, SIGNAL(foldersAdded()), this, SLOT(updateResources()));
|
connect(tree, &ProjectTree::foldersAdded, this, &ResourceHandler::updateResources);
|
||||||
connect(tree, SIGNAL(foldersRemoved()), this, SLOT(updateResources()));
|
connect(tree, &ProjectTree::foldersRemoved, this, &ResourceHandler::updateResources);
|
||||||
m_originalUiQrcPaths = m_form->activeResourceFilePaths();
|
m_originalUiQrcPaths = m_form->activeResourceFilePaths();
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << "ResourceHandler::ensureInitialized() origPaths=" << m_originalUiQrcPaths;
|
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)
|
if (m_handlingResources)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -61,10 +61,13 @@ public:
|
|||||||
virtual ~ResourceHandler();
|
virtual ~ResourceHandler();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateResources(bool updateProjectResources = false);
|
void updateResources() { updateResourcesHelper(false); }
|
||||||
|
void updateProjectResources() { updateResourcesHelper(true); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ensureInitialized();
|
void ensureInitialized();
|
||||||
|
void updateResourcesHelper(bool updateProjectResources);
|
||||||
|
|
||||||
QDesignerFormWindowInterface * const m_form;
|
QDesignerFormWindowInterface * const m_form;
|
||||||
QStringList m_originalUiQrcPaths;
|
QStringList m_originalUiQrcPaths;
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ FormResizer::FormResizer(QWidget *parent) :
|
|||||||
m_handles.reserve(SizeHandleRect::Left);
|
m_handles.reserve(SizeHandleRect::Left);
|
||||||
for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) {
|
for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) {
|
||||||
SizeHandleRect *shr = new SizeHandleRect(this, static_cast<SizeHandleRect::Direction>(i), this);
|
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);
|
m_handles.push_back(shr);
|
||||||
}
|
}
|
||||||
setState(SelectionHandleActive);
|
setState(SelectionHandleActive);
|
||||||
@@ -147,7 +147,7 @@ void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
|
|||||||
if (m_formWindow)
|
if (m_formWindow)
|
||||||
layout->addWidget(m_formWindow);
|
layout->addWidget(m_formWindow);
|
||||||
mainContainerChanged();
|
mainContainerChanged();
|
||||||
connect(fw, SIGNAL(mainContainerChanged(QWidget*)), this, SLOT(mainContainerChanged()));
|
connect(fw, &QDesignerFormWindowInterface::mainContainerChanged, this, &FormResizer::mainContainerChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormResizer::resizeEvent(QResizeEvent *event)
|
void FormResizer::resizeEvent(QResizeEvent *event)
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ void WidgetHost::setFormWindow(QDesignerFormWindowInterface *fw)
|
|||||||
m_formWindow->setAutoFillBackground(true);
|
m_formWindow->setAutoFillBackground(true);
|
||||||
m_formWindow->setBackgroundRole(QPalette::Background);
|
m_formWindow->setBackgroundRole(QPalette::Background);
|
||||||
|
|
||||||
connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect,QRect)),
|
connect(m_formResizer, &Internal::FormResizer::formWindowSizeChanged,
|
||||||
this, SLOT(fwSizeWasChanged(QRect,QRect)));
|
this, &WidgetHost::fwSizeWasChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize WidgetHost::formWindowSize() const
|
QSize WidgetHost::formWindowSize() const
|
||||||
|
|||||||
Reference in New Issue
Block a user