forked from qt-creator/qt-creator
Fixed Design Mode context handling
Some Qt Designer actions stayed visible and/or active while editing source files or when using the QML Designer even though they shouldn't. Fixed that by applying some manual context handling in the DesignMode. Reviewed-by: con Reviewed-by: Lasse Holmstedt <lasse.holmstedt@nokia.com>
This commit is contained in:
@@ -86,6 +86,7 @@ bool DesignModeCoreListener::coreAboutToClose()
|
|||||||
struct DesignEditorInfo {
|
struct DesignEditorInfo {
|
||||||
int widgetIndex;
|
int widgetIndex;
|
||||||
QStringList mimeTypes;
|
QStringList mimeTypes;
|
||||||
|
QList<int> context;
|
||||||
bool preferredMode;
|
bool preferredMode;
|
||||||
QWidget *widget;
|
QWidget *widget;
|
||||||
};
|
};
|
||||||
@@ -100,6 +101,7 @@ struct DesignModePrivate {
|
|||||||
|
|
||||||
EditorManager *m_editorManager;
|
EditorManager *m_editorManager;
|
||||||
QStackedWidget *m_stackWidget;
|
QStackedWidget *m_stackWidget;
|
||||||
|
QList<int> m_activeContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
DesignModePrivate::DesignModePrivate(DesignMode *q, EditorManager *editorManager) :
|
DesignModePrivate::DesignModePrivate(DesignMode *q, EditorManager *editorManager) :
|
||||||
@@ -118,6 +120,9 @@ DesignMode::DesignMode(EditorManager *editorManager) :
|
|||||||
|
|
||||||
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||||
this, SLOT(currentEditorChanged(Core::IEditor*)));
|
this, SLOT(currentEditorChanged(Core::IEditor*)));
|
||||||
|
|
||||||
|
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
|
||||||
|
this, SLOT(updateContext(Core::IMode*,Core::IMode*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
DesignMode::~DesignMode()
|
DesignMode::~DesignMode()
|
||||||
@@ -169,13 +174,17 @@ QStringList DesignMode::registeredMimeTypes() const
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignMode::registerDesignWidget(QWidget *widget, const QStringList &mimeTypes, bool preferDesignMode)
|
void DesignMode::registerDesignWidget(QWidget *widget,
|
||||||
|
const QStringList &mimeTypes,
|
||||||
|
const QList<int> &context,
|
||||||
|
bool preferDesignMode)
|
||||||
{
|
{
|
||||||
int index = d->m_stackWidget->addWidget(widget);
|
int index = d->m_stackWidget->addWidget(widget);
|
||||||
|
|
||||||
DesignEditorInfo *info = new DesignEditorInfo;
|
DesignEditorInfo *info = new DesignEditorInfo;
|
||||||
info->preferredMode = preferDesignMode;
|
info->preferredMode = preferDesignMode;
|
||||||
info->mimeTypes = mimeTypes;
|
info->mimeTypes = mimeTypes;
|
||||||
|
info->context = context;
|
||||||
info->widgetIndex = index;
|
info->widgetIndex = index;
|
||||||
info->widget = widget;
|
info->widget = widget;
|
||||||
d->m_editors.append(info);
|
d->m_editors.append(info);
|
||||||
@@ -206,12 +215,11 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
|
|||||||
if (type && !type.type().isEmpty())
|
if (type && !type.type().isEmpty())
|
||||||
mimeType = type.type();
|
mimeType = type.type();
|
||||||
|
|
||||||
|
foreach (DesignEditorInfo *editorInfo, d->m_editors) {
|
||||||
|
foreach (const QString &mime, editorInfo->mimeTypes) {
|
||||||
foreach(DesignEditorInfo *editorInfo, d->m_editors) {
|
|
||||||
foreach(QString mime, editorInfo->mimeTypes) {
|
|
||||||
if (mime == mimeType) {
|
if (mime == mimeType) {
|
||||||
d->m_stackWidget->setCurrentIndex(editorInfo->widgetIndex);
|
d->m_stackWidget->setCurrentIndex(editorInfo->widgetIndex);
|
||||||
|
setActiveContext(editorInfo->context);
|
||||||
mimeEditorAvailable = true;
|
mimeEditorAvailable = true;
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
if (editorInfo->preferredMode && core->modeManager()->currentMode() != this) {
|
if (editorInfo->preferredMode && core->modeManager()->currentMode() != this) {
|
||||||
@@ -225,8 +233,10 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mimeEditorAvailable)
|
if (!mimeEditorAvailable) {
|
||||||
|
setActiveContext(QList<int>());
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!mimeEditorAvailable && core->modeManager()->currentMode() == this)
|
if (!mimeEditorAvailable && core->modeManager()->currentMode() == this)
|
||||||
{
|
{
|
||||||
@@ -253,4 +263,38 @@ void DesignMode::updateActions()
|
|||||||
emit actionsUpdated(d->m_currentEditor.data());
|
emit actionsUpdated(d->m_currentEditor.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesignMode::updateContext(Core::IMode *newMode, Core::IMode *oldMode)
|
||||||
|
{
|
||||||
|
if (newMode == this) {
|
||||||
|
// Apply active context
|
||||||
|
Core::ICore *core = Core::ICore::instance();
|
||||||
|
foreach (int contextId, d->m_activeContext)
|
||||||
|
core->addAdditionalContext(contextId);
|
||||||
|
core->updateContext();
|
||||||
|
} else if (oldMode == this) {
|
||||||
|
// Remove active context
|
||||||
|
Core::ICore *core = Core::ICore::instance();
|
||||||
|
foreach (int contextId, d->m_activeContext)
|
||||||
|
core->removeAdditionalContext(contextId);
|
||||||
|
core->updateContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DesignMode::setActiveContext(const QList<int> &context)
|
||||||
|
{
|
||||||
|
if (d->m_activeContext == context)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ModeManager::instance()->currentMode() == this) {
|
||||||
|
// Update active context
|
||||||
|
Core::ICore *core = Core::ICore::instance();
|
||||||
|
foreach (int contextId, d->m_activeContext)
|
||||||
|
core->removeAdditionalContext(contextId);
|
||||||
|
foreach (int contextId, context)
|
||||||
|
core->addAdditionalContext(contextId);
|
||||||
|
core->updateContext();
|
||||||
|
}
|
||||||
|
d->m_activeContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -57,7 +57,9 @@ public:
|
|||||||
explicit DesignMode(EditorManager *editorManager);
|
explicit DesignMode(EditorManager *editorManager);
|
||||||
virtual ~DesignMode();
|
virtual ~DesignMode();
|
||||||
|
|
||||||
void registerDesignWidget(QWidget *widget, const QStringList &mimeTypes,
|
void registerDesignWidget(QWidget *widget,
|
||||||
|
const QStringList &mimeTypes,
|
||||||
|
const QList<int> &context,
|
||||||
bool preferDesignMode = false);
|
bool preferDesignMode = false);
|
||||||
void unregisterDesignWidget(QWidget *widget);
|
void unregisterDesignWidget(QWidget *widget);
|
||||||
|
|
||||||
@@ -79,8 +81,11 @@ signals:
|
|||||||
private slots:
|
private slots:
|
||||||
void currentEditorChanged(Core::IEditor *editor);
|
void currentEditorChanged(Core::IEditor *editor);
|
||||||
void updateActions();
|
void updateActions();
|
||||||
|
void updateContext(Core::IMode *newMode, Core::IMode *oldMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setActiveContext(const QList<int> &context);
|
||||||
|
|
||||||
DesignModePrivate *d;
|
DesignModePrivate *d;
|
||||||
friend class Internal::DesignModeCoreListener;
|
friend class Internal::DesignModeCoreListener;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -176,9 +176,7 @@ FormEditorW::FormEditorW() :
|
|||||||
QTC_ASSERT(m_fwm, return);
|
QTC_ASSERT(m_fwm, return);
|
||||||
|
|
||||||
Core::UniqueIDManager *idMan = Core::UniqueIDManager::instance();
|
Core::UniqueIDManager *idMan = Core::UniqueIDManager::instance();
|
||||||
m_contexts << idMan->uniqueIdentifier(QLatin1String(Designer::Constants::C_FORMEDITOR))
|
m_contexts << idMan->uniqueIdentifier(QLatin1String(Designer::Constants::C_FORMEDITOR));
|
||||||
<< idMan->uniqueIdentifier(QLatin1String(Core::Constants::C_EDITORMANAGER))
|
|
||||||
<< idMan->uniqueIdentifier(QLatin1String(Core::Constants::C_DESIGN_MODE));
|
|
||||||
|
|
||||||
setupActions();
|
setupActions();
|
||||||
|
|
||||||
@@ -333,7 +331,7 @@ void FormEditorW::fullInit()
|
|||||||
m_context = new DesignerContext(m_contexts, m_modeWidget, this);
|
m_context = new DesignerContext(m_contexts, m_modeWidget, this);
|
||||||
m_core->addContextObject(m_context);
|
m_core->addContextObject(m_context);
|
||||||
|
|
||||||
m_designMode->registerDesignWidget(m_modeWidget, QStringList(QLatin1String(FORM_MIMETYPE)));
|
m_designMode->registerDesignWidget(m_modeWidget, QStringList(QLatin1String(FORM_MIMETYPE)), m_contexts);
|
||||||
|
|
||||||
setupViewActions();
|
setupViewActions();
|
||||||
|
|
||||||
@@ -428,93 +426,90 @@ void FormEditorW::setupActions()
|
|||||||
command->setAttribute(Core::Command::CA_Hide);
|
command->setAttribute(Core::Command::CA_Hide);
|
||||||
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
||||||
|
|
||||||
QList<int> globalcontext;
|
|
||||||
globalcontext << m_core->uniqueIDManager()->uniqueIdentifier(Core::Constants::C_GLOBAL);
|
|
||||||
|
|
||||||
m_actionGroupEditMode = new QActionGroup(this);
|
m_actionGroupEditMode = new QActionGroup(this);
|
||||||
m_actionGroupEditMode->setExclusive(true);
|
m_actionGroupEditMode->setExclusive(true);
|
||||||
connect(m_actionGroupEditMode, SIGNAL(triggered(QAction*)), this, SLOT(activateEditMode(QAction*)));
|
connect(m_actionGroupEditMode, SIGNAL(triggered(QAction*)), this, SLOT(activateEditMode(QAction*)));
|
||||||
|
|
||||||
m_modeActionSeparator = new QAction(this);
|
m_modeActionSeparator = new QAction(this);
|
||||||
m_modeActionSeparator->setSeparator(true);
|
m_modeActionSeparator->setSeparator(true);
|
||||||
command = am->registerAction(m_modeActionSeparator, QLatin1String("FormEditor.Sep.ModeActions"), globalcontext);
|
command = am->registerAction(m_modeActionSeparator, QLatin1String("FormEditor.Sep.ModeActions"), m_contexts);
|
||||||
medit->addAction(command, Core::Constants::G_EDIT_OTHER);
|
medit->addAction(command, Core::Constants::G_EDIT_OTHER);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.WidgetEditor"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.WidgetEditor"));
|
||||||
createEditModeAction(m_actionGroupEditMode, globalcontext, am, medit,
|
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
|
||||||
tr("Edit widgets"), m_toolActionIds.back(),
|
tr("Edit widgets"), m_toolActionIds.back(),
|
||||||
EditModeWidgetEditor, QLatin1String("widgettool.png"), tr("F3"));
|
EditModeWidgetEditor, QLatin1String("widgettool.png"), tr("F3"));
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.SignalsSlotsEditor"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.SignalsSlotsEditor"));
|
||||||
createEditModeAction(m_actionGroupEditMode, globalcontext, am, medit,
|
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
|
||||||
tr("Edit signals/slots"), m_toolActionIds.back(),
|
tr("Edit signals/slots"), m_toolActionIds.back(),
|
||||||
EditModeSignalsSlotEditor, QLatin1String("signalslottool.png"), tr("F4"));
|
EditModeSignalsSlotEditor, QLatin1String("signalslottool.png"), tr("F4"));
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.BuddyEditor"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.BuddyEditor"));
|
||||||
createEditModeAction(m_actionGroupEditMode, globalcontext, am, medit,
|
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
|
||||||
tr("Edit buddies"), m_toolActionIds.back(),
|
tr("Edit buddies"), m_toolActionIds.back(),
|
||||||
EditModeBuddyEditor, QLatin1String("buddytool.png"));
|
EditModeBuddyEditor, QLatin1String("buddytool.png"));
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.TabOrderEditor"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.TabOrderEditor"));
|
||||||
createEditModeAction(m_actionGroupEditMode, globalcontext, am, medit,
|
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
|
||||||
tr("Edit tab order"), m_toolActionIds.back(),
|
tr("Edit tab order"), m_toolActionIds.back(),
|
||||||
EditModeTabOrderEditor, QLatin1String("tabordertool.png"));
|
EditModeTabOrderEditor, QLatin1String("tabordertool.png"));
|
||||||
|
|
||||||
//tool actions
|
//tool actions
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutHorizontally"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutHorizontally"));
|
||||||
const QString horizLayoutShortcut = osMac ? tr("Meta+H") : tr("Ctrl+H");
|
const QString horizLayoutShortcut = osMac ? tr("Meta+H") : tr("Ctrl+H");
|
||||||
addToolAction(m_fwm->actionHorizontalLayout(), am, globalcontext,
|
addToolAction(m_fwm->actionHorizontalLayout(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools, horizLayoutShortcut);
|
m_toolActionIds.back(), mformtools, horizLayoutShortcut);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutVertically"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutVertically"));
|
||||||
const QString vertLayoutShortcut = osMac ? tr("Meta+L") : tr("Ctrl+L");
|
const QString vertLayoutShortcut = osMac ? tr("Meta+L") : tr("Ctrl+L");
|
||||||
addToolAction(m_fwm->actionVerticalLayout(), am, globalcontext,
|
addToolAction(m_fwm->actionVerticalLayout(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools, vertLayoutShortcut);
|
m_toolActionIds.back(), mformtools, vertLayoutShortcut);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.SplitHorizontal"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.SplitHorizontal"));
|
||||||
addToolAction(m_fwm->actionSplitHorizontal(), am, globalcontext,
|
addToolAction(m_fwm->actionSplitHorizontal(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools);
|
m_toolActionIds.back(), mformtools);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.SplitVertical"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.SplitVertical"));
|
||||||
addToolAction(m_fwm->actionSplitVertical(), am, globalcontext,
|
addToolAction(m_fwm->actionSplitVertical(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools);
|
m_toolActionIds.back(), mformtools);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutForm"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutForm"));
|
||||||
addToolAction(m_fwm->actionFormLayout(), am, globalcontext,
|
addToolAction(m_fwm->actionFormLayout(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools);
|
m_toolActionIds.back(), mformtools);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutGrid"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutGrid"));
|
||||||
const QString gridShortcut = osMac ? tr("Meta+G") : tr("Ctrl+G");
|
const QString gridShortcut = osMac ? tr("Meta+G") : tr("Ctrl+G");
|
||||||
addToolAction(m_fwm->actionGridLayout(), am, globalcontext,
|
addToolAction(m_fwm->actionGridLayout(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools, gridShortcut);
|
m_toolActionIds.back(), mformtools, gridShortcut);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutBreak"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutBreak"));
|
||||||
addToolAction(m_fwm->actionBreakLayout(), am, globalcontext,
|
addToolAction(m_fwm->actionBreakLayout(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools);
|
m_toolActionIds.back(), mformtools);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutAdjustSize"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.LayoutAdjustSize"));
|
||||||
const QString adjustShortcut = osMac ? tr("Meta+J") : tr("Ctrl+J");
|
const QString adjustShortcut = osMac ? tr("Meta+J") : tr("Ctrl+J");
|
||||||
addToolAction(m_fwm->actionAdjustSize(), am, globalcontext,
|
addToolAction(m_fwm->actionAdjustSize(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools, adjustShortcut);
|
m_toolActionIds.back(), mformtools, adjustShortcut);
|
||||||
|
|
||||||
m_toolActionIds.push_back(QLatin1String("FormEditor.SimplifyLayout"));
|
m_toolActionIds.push_back(QLatin1String("FormEditor.SimplifyLayout"));
|
||||||
addToolAction(m_fwm->actionSimplifyLayout(), am, globalcontext,
|
addToolAction(m_fwm->actionSimplifyLayout(), am, m_contexts,
|
||||||
m_toolActionIds.back(), mformtools);
|
m_toolActionIds.back(), mformtools);
|
||||||
|
|
||||||
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator1"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator1"));
|
||||||
|
|
||||||
addToolAction(m_fwm->actionLower(), am, globalcontext,
|
addToolAction(m_fwm->actionLower(), am, m_contexts,
|
||||||
QLatin1String("FormEditor.Lower"), mformtools);
|
QLatin1String("FormEditor.Lower"), mformtools);
|
||||||
|
|
||||||
addToolAction(m_fwm->actionRaise(), am, globalcontext,
|
addToolAction(m_fwm->actionRaise(), am, m_contexts,
|
||||||
QLatin1String("FormEditor.Raise"), mformtools);
|
QLatin1String("FormEditor.Raise"), mformtools);
|
||||||
|
|
||||||
// Commands that do not go into the editor toolbar
|
// Commands that do not go into the editor toolbar
|
||||||
createSeparator(this, am, globalcontext, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator2"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator2"));
|
||||||
|
|
||||||
m_actionPreview = m_fwm->actionDefaultPreview();
|
m_actionPreview = m_fwm->actionDefaultPreview();
|
||||||
QTC_ASSERT(m_actionPreview, return);
|
QTC_ASSERT(m_actionPreview, return);
|
||||||
addToolAction(m_actionPreview, am, globalcontext,
|
addToolAction(m_actionPreview, am, m_contexts,
|
||||||
QLatin1String("FormEditor.Preview"), mformtools, tr("Ctrl+Alt+R"));
|
QLatin1String("FormEditor.Preview"), mformtools, tr("Ctrl+Alt+R"));
|
||||||
|
|
||||||
// Preview in style...
|
// Preview in style...
|
||||||
@@ -524,19 +519,19 @@ void FormEditorW::setupActions()
|
|||||||
// Form settings
|
// Form settings
|
||||||
createSeparator(this, am, m_contexts, medit, QLatin1String("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER);
|
createSeparator(this, am, m_contexts, medit, QLatin1String("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER);
|
||||||
|
|
||||||
createSeparator(this, am, globalcontext, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator3"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator3"));
|
||||||
QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog();
|
QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog();
|
||||||
addToolAction(actionFormSettings, am, globalcontext, QLatin1String("FormEditor.FormSettings"), mformtools);
|
addToolAction(actionFormSettings, am, m_contexts, QLatin1String("FormEditor.FormSettings"), mformtools);
|
||||||
|
|
||||||
createSeparator(this, am, globalcontext, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator4"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator4"));
|
||||||
m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this);
|
m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this);
|
||||||
addToolAction(m_actionAboutPlugins, am, globalcontext,
|
addToolAction(m_actionAboutPlugins, am, m_contexts,
|
||||||
QLatin1String("FormEditor.AboutPlugins"), mformtools);
|
QLatin1String("FormEditor.AboutPlugins"), mformtools);
|
||||||
connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm, SLOT(aboutPlugins()));
|
connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm, SLOT(aboutPlugins()));
|
||||||
m_actionAboutPlugins->setEnabled(false);
|
m_actionAboutPlugins->setEnabled(false);
|
||||||
|
|
||||||
// Views. Populated later on.
|
// Views. Populated later on.
|
||||||
createSeparator(this, am, globalcontext, mformtools, QLatin1String("FormEditor.Menu.Tools.SeparatorViews"));
|
createSeparator(this, am, m_contexts, mformtools, QLatin1String("FormEditor.Menu.Tools.SeparatorViews"));
|
||||||
|
|
||||||
m_viewMenu = am->createMenu(QLatin1String(M_FORMEDITOR_VIEWS));
|
m_viewMenu = am->createMenu(QLatin1String(M_FORMEDITOR_VIEWS));
|
||||||
m_viewMenu->menu()->setTitle(tr("Views"));
|
m_viewMenu->menu()->setTitle(tr("Views"));
|
||||||
@@ -639,6 +634,7 @@ QAction *FormEditorW::createEditModeAction(QActionGroup *ag,
|
|||||||
if (!iconName.isEmpty())
|
if (!iconName.isEmpty())
|
||||||
rc->setIcon(designerIcon(iconName));
|
rc->setIcon(designerIcon(iconName));
|
||||||
Core::Command *command = am->registerAction(rc, name, context);
|
Core::Command *command = am->registerAction(rc, name, context);
|
||||||
|
command->setAttribute(Core::Command::CA_Hide);
|
||||||
if (!keySequence.isEmpty())
|
if (!keySequence.isEmpty())
|
||||||
command->setDefaultKeySequence(QKeySequence(keySequence));
|
command->setDefaultKeySequence(QKeySequence(keySequence));
|
||||||
bindShortcut(command, rc);
|
bindShortcut(command, rc);
|
||||||
@@ -715,12 +711,6 @@ void FormEditorW::currentEditorChanged(Core::IEditor *editor)
|
|||||||
QTC_ASSERT(fw, return)
|
QTC_ASSERT(fw, return)
|
||||||
m_editorWidget->setVisibleEditor(xmlEditor);
|
m_editorWidget->setVisibleEditor(xmlEditor);
|
||||||
m_fwm->setActiveFormWindow(fw->formWindow());
|
m_fwm->setActiveFormWindow(fw->formWindow());
|
||||||
m_actionGroupEditMode->setVisible(true);
|
|
||||||
m_modeActionSeparator->setVisible(true);
|
|
||||||
} else {
|
|
||||||
// Deactivate Designer if a non-form is being edited
|
|
||||||
m_actionGroupEditMode->setVisible(false);
|
|
||||||
m_modeActionSeparator->setVisible(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ void BauhausPlugin::extensionsInitialized()
|
|||||||
m_mimeTypes << "application/x-qml" << "application/javascript"
|
m_mimeTypes << "application/x-qml" << "application/javascript"
|
||||||
<< "application/x-javascript" << "text/javascript";
|
<< "application/x-javascript" << "text/javascript";
|
||||||
|
|
||||||
m_designMode->registerDesignWidget(m_mainWidget, m_mimeTypes);
|
m_designMode->registerDesignWidget(m_mainWidget, m_mimeTypes, m_context->context());
|
||||||
connect(m_designMode, SIGNAL(actionsUpdated(Core::IEditor*)), SLOT(updateActions(Core::IEditor*)));
|
connect(m_designMode, SIGNAL(actionsUpdated(Core::IEditor*)), SLOT(updateActions(Core::IEditor*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user