forked from qt-creator/qt-creator
Designer: Remove FormEditorW class
Just wrapped static functions. Change-Id: Ic60a2d7185aab5576e48894c74a9314a4b1c2324 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -25,7 +25,7 @@ DesignerContext::DesignerContext(const Core::Context &context,
|
|||||||
|
|
||||||
void DesignerContext::contextHelp(const HelpCallback &callback) const
|
void DesignerContext::contextHelp(const HelpCallback &callback) const
|
||||||
{
|
{
|
||||||
const QDesignerFormEditorInterface *core = FormEditorW::designerEditor();
|
const QDesignerFormEditorInterface *core = designerEditor();
|
||||||
callback(core->integration()->contextHelpId());
|
callback(core->integration()->contextHelpId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ EditorWidget::EditorWidget(QWidget *parent) :
|
|||||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||||
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
||||||
|
|
||||||
QWidget * const*subs = FormEditorW::designerSubWindows();
|
QWidget * const * subs = designerSubWindows();
|
||||||
for (int i = 0; i < DesignerSubWindowCount; i++) {
|
for (int i = 0; i < DesignerSubWindowCount; i++) {
|
||||||
QWidget *subWindow = subs[i];
|
QWidget *subWindow = subs[i];
|
||||||
subWindow->setWindowTitle(subs[i]->windowTitle());
|
subWindow->setWindowTitle(subs[i]->windowTitle());
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "designertr.h"
|
|
||||||
#include "formeditorfactory.h"
|
#include "formeditorfactory.h"
|
||||||
|
|
||||||
|
#include "designerconstants.h"
|
||||||
|
#include "designertr.h"
|
||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
#include "formwindoweditor.h"
|
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/fsengine/fileiconprovider.h>
|
#include <utils/fsengine/fileiconprovider.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Designer::Constants;
|
using namespace Designer::Constants;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -25,7 +23,7 @@ FormEditorFactory::FormEditorFactory()
|
|||||||
setId(K_DESIGNER_XML_EDITOR_ID);
|
setId(K_DESIGNER_XML_EDITOR_ID);
|
||||||
setDisplayName(Tr::tr(C_DESIGNER_XML_DISPLAY_NAME));
|
setDisplayName(Tr::tr(C_DESIGNER_XML_DISPLAY_NAME));
|
||||||
addMimeType(FORM_MIMETYPE);
|
addMimeType(FORM_MIMETYPE);
|
||||||
setEditorCreator([] { return FormEditorW::createEditor(); });
|
setEditorCreator([] { return Designer::Internal::createEditor(); });
|
||||||
|
|
||||||
FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_UI, "ui");
|
FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_UI, "ui");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#include "formeditorplugin.h"
|
||||||
|
|
||||||
|
#include "designerconstants.h"
|
||||||
#include "designertr.h"
|
#include "designertr.h"
|
||||||
#include "formeditorfactory.h"
|
#include "formeditorfactory.h"
|
||||||
#include "formeditorplugin.h"
|
|
||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
#include "formtemplatewizardpage.h"
|
#include "formtemplatewizardpage.h"
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@ public:
|
|||||||
|
|
||||||
FormEditorPlugin::~FormEditorPlugin()
|
FormEditorPlugin::~FormEditorPlugin()
|
||||||
{
|
{
|
||||||
FormEditorW::deleteInstance();
|
deleteInstance();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "formeditorstack.h"
|
#include "formeditorstack.h"
|
||||||
|
|
||||||
|
#include "designerconstants.h"
|
||||||
#include "formwindoweditor.h"
|
#include "formwindoweditor.h"
|
||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
#include "formwindowfile.h"
|
#include "formwindowfile.h"
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------- FormEditorW
|
// FormEditorData
|
||||||
|
|
||||||
class FormEditorData
|
class FormEditorData : public QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FormEditorData();
|
FormEditorData();
|
||||||
@@ -173,7 +173,7 @@ public:
|
|||||||
QDesignerFormEditorInterface *m_formeditor = nullptr;
|
QDesignerFormEditorInterface *m_formeditor = nullptr;
|
||||||
QtCreatorIntegration *m_integration = nullptr;
|
QtCreatorIntegration *m_integration = nullptr;
|
||||||
QDesignerFormWindowManagerInterface *m_fwm = nullptr;
|
QDesignerFormWindowManagerInterface *m_fwm = nullptr;
|
||||||
FormEditorW::InitializationStage m_initStage = FormEditorW::RegisterPlugins;
|
InitializationStage m_initStage = RegisterPlugins;
|
||||||
|
|
||||||
QWidget *m_designerSubWindows[DesignerSubWindowCount];
|
QWidget *m_designerSubWindows[DesignerSubWindowCount];
|
||||||
|
|
||||||
@@ -202,7 +202,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static FormEditorData *d = nullptr;
|
static FormEditorData *d = nullptr;
|
||||||
static FormEditorW *m_instance = nullptr;
|
|
||||||
|
|
||||||
FormEditorData::FormEditorData() :
|
FormEditorData::FormEditorData() :
|
||||||
m_formeditor(QDesignerComponents::createFormEditor(nullptr))
|
m_formeditor(QDesignerComponents::createFormEditor(nullptr))
|
||||||
@@ -238,7 +237,7 @@ FormEditorData::FormEditorData() :
|
|||||||
if (editor && editor->document()->id() == Constants::K_DESIGNER_XML_EDITOR_ID) {
|
if (editor && editor->document()->id() == Constants::K_DESIGNER_XML_EDITOR_ID) {
|
||||||
FormWindowEditor *xmlEditor = qobject_cast<FormWindowEditor *>(editor);
|
FormWindowEditor *xmlEditor = qobject_cast<FormWindowEditor *>(editor);
|
||||||
QTC_ASSERT(xmlEditor, return);
|
QTC_ASSERT(xmlEditor, return);
|
||||||
FormEditorW::ensureInitStage(FormEditorW::FullyInitialized);
|
ensureInitStage(FullyInitialized);
|
||||||
SharedTools::WidgetHost *fw = m_editorWidget->formWindowEditorForXmlEditor(xmlEditor);
|
SharedTools::WidgetHost *fw = m_editorWidget->formWindowEditorForXmlEditor(xmlEditor);
|
||||||
QTC_ASSERT(fw, return);
|
QTC_ASSERT(fw, return);
|
||||||
m_editorWidget->setVisibleEditor(xmlEditor);
|
m_editorWidget->setVisibleEditor(xmlEditor);
|
||||||
@@ -251,7 +250,7 @@ FormEditorData::FormEditorData() :
|
|||||||
|
|
||||||
FormEditorData::~FormEditorData()
|
FormEditorData::~FormEditorData()
|
||||||
{
|
{
|
||||||
if (m_initStage == FormEditorW::FullyInitialized) {
|
if (m_initStage == FullyInitialized) {
|
||||||
QSettings *s = ICore::settings();
|
QSettings *s = ICore::settings();
|
||||||
s->beginGroup(settingsGroupC);
|
s->beginGroup(settingsGroupC);
|
||||||
m_editorWidget->saveSettings(s);
|
m_editorWidget->saveSettings(s);
|
||||||
@@ -324,18 +323,18 @@ void FormEditorData::setupViewActions()
|
|||||||
|
|
||||||
void FormEditorData::fullInit()
|
void FormEditorData::fullInit()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_initStage == FormEditorW::RegisterPlugins, return);
|
QTC_ASSERT(m_initStage == RegisterPlugins, return);
|
||||||
QElapsedTimer *initTime = nullptr;
|
QElapsedTimer *initTime = nullptr;
|
||||||
if (Designer::Constants::Internal::debug) {
|
if (Designer::Constants::Internal::debug) {
|
||||||
initTime = new QElapsedTimer;
|
initTime = new QElapsedTimer;
|
||||||
initTime->start();
|
initTime->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDesignerComponents::createTaskMenu(m_formeditor, m_instance);
|
QDesignerComponents::createTaskMenu(m_formeditor, this);
|
||||||
QDesignerComponents::initializePlugins(m_formeditor);
|
QDesignerComponents::initializePlugins(m_formeditor);
|
||||||
QDesignerComponents::initializeResources();
|
QDesignerComponents::initializeResources();
|
||||||
initDesignerSubWindows();
|
initDesignerSubWindows();
|
||||||
m_integration = new QtCreatorIntegration(m_formeditor, m_instance);
|
m_integration = new QtCreatorIntegration(m_formeditor, this);
|
||||||
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, &QtCreatorIntegration::creatorHelpRequested,
|
QObject::connect(m_integration, &QtCreatorIntegration::creatorHelpRequested,
|
||||||
@@ -397,13 +396,13 @@ void FormEditorData::fullInit()
|
|||||||
|
|
||||||
Context designerContexts = m_contexts;
|
Context designerContexts = m_contexts;
|
||||||
designerContexts.add(Core::Constants::C_EDITORMANAGER);
|
designerContexts.add(Core::Constants::C_EDITORMANAGER);
|
||||||
ICore::addContextObject(new DesignerContext(designerContexts, m_modeWidget, m_instance));
|
ICore::addContextObject(new DesignerContext(designerContexts, m_modeWidget, this));
|
||||||
|
|
||||||
DesignMode::registerDesignWidget(m_modeWidget, QStringList(FORM_MIMETYPE), m_contexts);
|
DesignMode::registerDesignWidget(m_modeWidget, QStringList(FORM_MIMETYPE), m_contexts);
|
||||||
|
|
||||||
setupViewActions();
|
setupViewActions();
|
||||||
|
|
||||||
m_initStage = FormEditorW::FullyInitialized;
|
m_initStage = FullyInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorData::initDesignerSubWindows()
|
void FormEditorData::initDesignerSubWindows()
|
||||||
@@ -438,22 +437,21 @@ void FormEditorData::initDesignerSubWindows()
|
|||||||
ae->setObjectName("ActionEditor");
|
ae->setObjectName("ActionEditor");
|
||||||
m_formeditor->setActionEditor(ae);
|
m_formeditor->setActionEditor(ae);
|
||||||
m_designerSubWindows[ActionEditorSubWindow] = ae;
|
m_designerSubWindows[ActionEditorSubWindow] = ae;
|
||||||
m_initStage = FormEditorW::SubwindowsInitialized;
|
m_initStage = SubwindowsInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<IOptionsPage *> FormEditorW::optionsPages()
|
QList<IOptionsPage *> optionsPages()
|
||||||
{
|
{
|
||||||
return d->m_settingsPages;
|
return d->m_settingsPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorW::ensureInitStage(InitializationStage s)
|
void ensureInitStage(InitializationStage s)
|
||||||
{
|
{
|
||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << Q_FUNC_INFO << s;
|
qDebug() << Q_FUNC_INFO << s;
|
||||||
if (!d) {
|
if (!d)
|
||||||
m_instance = new FormEditorW;
|
|
||||||
d = new FormEditorData;
|
d = new FormEditorData;
|
||||||
}
|
|
||||||
if (d->m_initStage >= s)
|
if (d->m_initStage >= s)
|
||||||
return;
|
return;
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
@@ -461,15 +459,13 @@ void FormEditorW::ensureInitStage(InitializationStage s)
|
|||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorW::deleteInstance()
|
void deleteInstance()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
d = nullptr;
|
d = nullptr;
|
||||||
delete m_instance;
|
|
||||||
m_instance = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditor *FormEditorW::createEditor()
|
IEditor *createEditor()
|
||||||
{
|
{
|
||||||
ensureInitStage(FullyInitialized);
|
ensureInitStage(FullyInitialized);
|
||||||
return d->createEditor();
|
return d->createEditor();
|
||||||
@@ -489,7 +485,7 @@ void FormEditorData::setupActions()
|
|||||||
bindShortcut(ActionManager::registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_contexts), m_fwm->actionPaste());
|
bindShortcut(ActionManager::registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_contexts), m_fwm->actionPaste());
|
||||||
bindShortcut(ActionManager::registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_contexts), m_fwm->actionSelectAll());
|
bindShortcut(ActionManager::registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_contexts), m_fwm->actionSelectAll());
|
||||||
|
|
||||||
m_actionPrint = new QAction(m_instance);
|
m_actionPrint = new QAction(this);
|
||||||
bindShortcut(ActionManager::registerAction(m_actionPrint, Core::Constants::PRINT, m_contexts), m_actionPrint);
|
bindShortcut(ActionManager::registerAction(m_actionPrint, Core::Constants::PRINT, m_contexts), m_actionPrint);
|
||||||
QObject::connect(m_actionPrint, &QAction::triggered, [this]() { print(); });
|
QObject::connect(m_actionPrint, &QAction::triggered, [this]() { print(); });
|
||||||
|
|
||||||
@@ -502,7 +498,7 @@ void FormEditorData::setupActions()
|
|||||||
command->setAttribute(Command::CA_Hide);
|
command->setAttribute(Command::CA_Hide);
|
||||||
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
||||||
|
|
||||||
m_actionGroupEditMode = new QActionGroup(m_instance);
|
m_actionGroupEditMode = new QActionGroup(this);
|
||||||
m_actionGroupEditMode->setExclusive(true);
|
m_actionGroupEditMode->setExclusive(true);
|
||||||
QObject::connect(m_actionGroupEditMode, &QActionGroup::triggered,
|
QObject::connect(m_actionGroupEditMode, &QActionGroup::triggered,
|
||||||
[this](QAction *a) { activateEditMode(a->data().toInt()); });
|
[this](QAction *a) { activateEditMode(a->data().toInt()); });
|
||||||
@@ -601,7 +597,7 @@ void FormEditorData::setupActions()
|
|||||||
QString(), Core::Constants::G_DEFAULT_THREE);
|
QString(), Core::Constants::G_DEFAULT_THREE);
|
||||||
|
|
||||||
mformtools->addSeparator(m_contexts, Core::Constants::G_DEFAULT_THREE);
|
mformtools->addSeparator(m_contexts, Core::Constants::G_DEFAULT_THREE);
|
||||||
m_actionAboutPlugins = new QAction(Tr::tr("About Qt Designer Plugins..."), m_instance);
|
m_actionAboutPlugins = new QAction(Tr::tr("About Qt Designer Plugins..."), d);
|
||||||
addToolAction(m_actionAboutPlugins, m_contexts, "FormEditor.AboutPlugins", mformtools,
|
addToolAction(m_actionAboutPlugins, m_contexts, "FormEditor.AboutPlugins", mformtools,
|
||||||
QString(), Core::Constants::G_DEFAULT_THREE);
|
QString(), Core::Constants::G_DEFAULT_THREE);
|
||||||
QObject::connect(m_actionAboutPlugins, &QAction::triggered,
|
QObject::connect(m_actionAboutPlugins, &QAction::triggered,
|
||||||
@@ -760,19 +756,19 @@ IEditor *FormEditorData::createEditor()
|
|||||||
return formWindowEditor;
|
return formWindowEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDesignerFormEditorInterface *FormEditorW::designerEditor()
|
QDesignerFormEditorInterface *designerEditor()
|
||||||
{
|
{
|
||||||
ensureInitStage(FullyInitialized);
|
ensureInitStage(FullyInitialized);
|
||||||
return d->m_formeditor;
|
return d->m_formeditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget * const *FormEditorW::designerSubWindows()
|
QWidget * const *designerSubWindows()
|
||||||
{
|
{
|
||||||
ensureInitStage(SubwindowsInitialized);
|
ensureInitStage(SubwindowsInitialized);
|
||||||
return d->m_designerSubWindows;
|
return d->m_designerSubWindows;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedTools::WidgetHost *FormEditorW::activeWidgetHost()
|
SharedTools::WidgetHost *activeWidgetHost()
|
||||||
{
|
{
|
||||||
ensureInitStage(FullyInitialized);
|
ensureInitStage(FullyInitialized);
|
||||||
if (d->m_editorWidget)
|
if (d->m_editorWidget)
|
||||||
@@ -780,7 +776,7 @@ SharedTools::WidgetHost *FormEditorW::activeWidgetHost()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormWindowEditor *FormEditorW::activeEditor()
|
FormWindowEditor *activeEditor()
|
||||||
{
|
{
|
||||||
ensureInitStage(FullyInitialized);
|
ensureInitStage(FullyInitialized);
|
||||||
if (d->m_editorWidget)
|
if (d->m_editorWidget)
|
||||||
|
|||||||
@@ -3,12 +3,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "designerconstants.h"
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QDesignerFormEditorInterface;
|
class QDesignerFormEditorInterface;
|
||||||
|
class QWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -24,11 +23,10 @@ class FormWindowEditor;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
/** FormEditorW is a singleton that stores the Designer CoreInterface and
|
/** This is an interface to the Designer CoreInterface to
|
||||||
* performs centralized operations. The instance() function will return an
|
* performs centralized operations.
|
||||||
* instance. However, it must be manually deleted when unloading the
|
* Since fully initializing Designer at startup is expensive, the
|
||||||
* plugin. Since fully initializing Designer at startup is expensive, the
|
* setup has an internal partial initialization stage "RegisterPlugins"
|
||||||
* class has an internal partial initialisation stage "RegisterPlugins"
|
|
||||||
* which is there to register the Creator plugin objects
|
* which is there to register the Creator plugin objects
|
||||||
* that must be present at startup (settings pages, actions).
|
* that must be present at startup (settings pages, actions).
|
||||||
* The plugin uses this stage at first by calling ensureInitStage().
|
* The plugin uses this stage at first by calling ensureInitStage().
|
||||||
@@ -38,32 +36,29 @@ namespace Internal {
|
|||||||
*
|
*
|
||||||
* The form editor shows a read-only XML editor in edit mode and Qt Designer
|
* The form editor shows a read-only XML editor in edit mode and Qt Designer
|
||||||
* in Design mode. */
|
* in Design mode. */
|
||||||
class FormEditorW : public QObject
|
|
||||||
{
|
enum InitializationStage {
|
||||||
public:
|
|
||||||
enum InitializationStage {
|
|
||||||
// Register Creator plugins (settings pages, actions)
|
// Register Creator plugins (settings pages, actions)
|
||||||
RegisterPlugins,
|
RegisterPlugins,
|
||||||
// Subwindows of the designer are initialized
|
// Subwindows of the designer are initialized
|
||||||
SubwindowsInitialized,
|
SubwindowsInitialized,
|
||||||
// Fully initialized for handling editor requests
|
// Fully initialized for handling editor requests
|
||||||
FullyInitialized
|
FullyInitialized
|
||||||
};
|
|
||||||
|
|
||||||
// Create an instance and initialize up to stage s
|
|
||||||
static void ensureInitStage(InitializationStage s);
|
|
||||||
// Deletes an existing instance if there is one.
|
|
||||||
static void deleteInstance();
|
|
||||||
|
|
||||||
static Core::IEditor *createEditor();
|
|
||||||
|
|
||||||
static QDesignerFormEditorInterface *designerEditor();
|
|
||||||
static QWidget * const *designerSubWindows();
|
|
||||||
|
|
||||||
static SharedTools::WidgetHost *activeWidgetHost();
|
|
||||||
static FormWindowEditor *activeEditor();
|
|
||||||
static QList<Core::IOptionsPage *> optionsPages();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Create an instance and initialize up to stage s
|
||||||
|
void ensureInitStage(InitializationStage s);
|
||||||
|
// Deletes an existing instance if there is one.
|
||||||
|
void deleteInstance();
|
||||||
|
|
||||||
|
Core::IEditor *createEditor();
|
||||||
|
|
||||||
|
QDesignerFormEditorInterface *designerEditor();
|
||||||
|
QWidget * const *designerSubWindows();
|
||||||
|
|
||||||
|
SharedTools::WidgetHost *activeWidgetHost();
|
||||||
|
FormWindowEditor *activeEditor();
|
||||||
|
QList<Core::IOptionsPage *> optionsPages();
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Designer
|
} // namespace Designer
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ bool FormPageFactory::validateData(Utils::Id typeId, const QVariant &data, QStri
|
|||||||
|
|
||||||
FormTemplateWizardPage::FormTemplateWizardPage(QWidget * parent) :
|
FormTemplateWizardPage::FormTemplateWizardPage(QWidget * parent) :
|
||||||
Utils::WizardPage(parent),
|
Utils::WizardPage(parent),
|
||||||
m_newFormWidget(QDesignerNewFormWidgetInterface::createNewFormWidget(FormEditorW::designerEditor())),
|
m_newFormWidget(QDesignerNewFormWidgetInterface::createNewFormWidget(designerEditor())),
|
||||||
m_templateSelected(m_newFormWidget->hasCurrentTemplate())
|
m_templateSelected(m_newFormWidget->hasCurrentTemplate())
|
||||||
{
|
{
|
||||||
setTitle(Tr::tr("Choose a Form Template"));
|
setTitle(Tr::tr("Choose a Form Template"));
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public:
|
|||||||
waitForFilesInGlobalSnapshot({cppFile, hFile});
|
waitForFilesInGlobalSnapshot({cppFile, hFile});
|
||||||
|
|
||||||
// Execute "Go To Slot"
|
// Execute "Go To Slot"
|
||||||
QDesignerIntegrationInterface *integration = FormEditorW::designerEditor()->integration();
|
QDesignerIntegrationInterface *integration = designerEditor()->integration();
|
||||||
QVERIFY(integration);
|
QVERIFY(integration);
|
||||||
integration->emitNavigateToSlot("pushButton", "clicked()", QStringList());
|
integration->emitNavigateToSlot("pushButton", "clicked()", QStringList());
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#include "qtcreatorintegration.h"
|
||||||
|
|
||||||
|
#include "designerconstants.h"
|
||||||
#include "designertr.h"
|
#include "designertr.h"
|
||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
#include "formwindoweditor.h"
|
#include "formwindoweditor.h"
|
||||||
#include "qtcreatorintegration.h"
|
|
||||||
#include <widgethost.h>
|
#include <widgethost.h>
|
||||||
#include <designer/cpp/formclasswizardpage.h>
|
#include <designer/cpp/formclasswizardpage.h>
|
||||||
|
|
||||||
@@ -156,14 +159,14 @@ void QtCreatorIntegration::slotDesignerHelpRequested(const QString &manual, cons
|
|||||||
|
|
||||||
void QtCreatorIntegration::updateSelection()
|
void QtCreatorIntegration::updateSelection()
|
||||||
{
|
{
|
||||||
if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost())
|
if (SharedTools::WidgetHost *host = activeWidgetHost())
|
||||||
host->updateFormWindowSelectionHandles(true);
|
host->updateFormWindowSelectionHandles(true);
|
||||||
QDesignerIntegration::updateSelection();
|
QDesignerIntegration::updateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const
|
QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const
|
||||||
{
|
{
|
||||||
if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost())
|
if (SharedTools::WidgetHost *host = activeWidgetHost())
|
||||||
return host->integrationContainer();
|
return host->integrationContainer();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -435,7 +438,7 @@ void QtCreatorIntegration::slotNavigateToSlot(const QString &objectName, const Q
|
|||||||
{
|
{
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
if (!navigateToSlot(objectName, signalSignature, parameterNames, &errorMessage) && !errorMessage.isEmpty())
|
if (!navigateToSlot(objectName, signalSignature, parameterNames, &errorMessage) && !errorMessage.isEmpty())
|
||||||
QMessageBox::warning(FormEditorW::designerEditor()->topLevel(), Tr::tr("Error finding/adding a slot."), errorMessage);
|
QMessageBox::warning(designerEditor()->topLevel(), Tr::tr("Error finding/adding a slot."), errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build name of the class as generated by uic, insert Ui namespace
|
// Build name of the class as generated by uic, insert Ui namespace
|
||||||
@@ -480,7 +483,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
|||||||
{
|
{
|
||||||
using DocumentMap = QMap<int, Document::Ptr>;
|
using DocumentMap = QMap<int, Document::Ptr>;
|
||||||
|
|
||||||
const Utils::FilePath currentUiFile = FormEditorW::activeEditor()->document()->filePath();
|
const Utils::FilePath currentUiFile = activeEditor()->document()->filePath();
|
||||||
#if 0
|
#if 0
|
||||||
return Designer::Internal::navigateToSlot(currentUiFile.toString(), objectName,
|
return Designer::Internal::navigateToSlot(currentUiFile.toString(), objectName,
|
||||||
signalSignature, parameterNames, errorMessage);
|
signalSignature, parameterNames, errorMessage);
|
||||||
@@ -533,7 +536,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDesignerFormWindowInterface *fwi = FormEditorW::activeWidgetHost()->formWindow();
|
QDesignerFormWindowInterface *fwi = activeWidgetHost()->formWindow();
|
||||||
|
|
||||||
QString uiClass;
|
QString uiClass;
|
||||||
const Class *cl = nullptr;
|
const Class *cl = nullptr;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#include "settingspage.h"
|
||||||
|
|
||||||
|
#include "designerconstants.h"
|
||||||
#include "designertr.h"
|
#include "designertr.h"
|
||||||
#include "formeditorw.h"
|
#include "formeditorw.h"
|
||||||
#include "settingspage.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
@@ -54,9 +56,9 @@ QList<Core::IOptionsPage *> SettingsPageProvider::pages() const
|
|||||||
if (!m_initialized) {
|
if (!m_initialized) {
|
||||||
// get options pages from designer
|
// get options pages from designer
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins);
|
ensureInitStage(RegisterPlugins);
|
||||||
}
|
}
|
||||||
return FormEditorW::optionsPages();
|
return optionsPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SettingsPageProvider::matches(const QRegularExpression ®ex) const
|
bool SettingsPageProvider::matches(const QRegularExpression ®ex) const
|
||||||
|
|||||||
Reference in New Issue
Block a user