From 17b5354e2c88f785d552777912d18ac9ffc14f68 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 29 Jun 2010 09:29:18 +0200 Subject: [PATCH] =?UTF-8?q?Designer:=20Initially=20disable=20form=20previe?= =?UTF-8?q?w.=20Reviewed-by:=20Kai=20K=C3=B6hne=20<kai.koehne@nokia.com>?= =?UTF-8?q?=20Task-number:=20QTCREATORBUG-1762?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/designer/formeditorw.cpp | 15 ++++++++++++--- src/plugins/designer/formeditorw.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 5b3edd1db29..34cbb195944 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -152,6 +152,7 @@ FormEditorW::FormEditorW() : m_actionPrint(0), m_actionPreview(0), m_actionGroupPreviewInStyle(0), + m_previewInStyleMenu(0), m_actionAboutPlugins(0), m_shortcutMapper(new QSignalMapper(this)), m_context(0), @@ -533,7 +534,10 @@ void FormEditorW::setupActions() // Preview in style... m_actionGroupPreviewInStyle = m_fwm->actionGroupPreviewInStyle(); - mformtools->addMenu(createPreviewStyleMenu(am, m_actionGroupPreviewInStyle)); + Core::ActionContainer *previewAC = createPreviewStyleMenu(am, m_actionGroupPreviewInStyle); + m_previewInStyleMenu = previewAC->menu(); + mformtools->addMenu(previewAC); + setPreviewMenuEnabled(false); // Form settings createSeparator(this, am, m_contexts, medit, QLatin1String("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER); @@ -608,6 +612,12 @@ Core::ActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManager * return menuPreviewStyle; } +void FormEditorW::setPreviewMenuEnabled(bool e) +{ + m_actionPreview->setEnabled(e); + m_previewInStyleMenu->setEnabled(e); +} + void FormEditorW::saveSettings(QSettings *s) { s->beginGroup(settingsGroup); @@ -731,8 +741,7 @@ void FormEditorW::activeFormWindowChanged(QDesignerFormWindowInterface *afw) qDebug() << Q_FUNC_INFO << afw << " of " << m_fwm->formWindowCount(); m_fwm->closeAllPreviews(); - m_actionPreview->setEnabled(afw != 0); - m_actionGroupPreviewInStyle->setEnabled(afw != 0); + setPreviewMenuEnabled(afw != 0); } EditorData FormEditorW::activeEditor() const diff --git a/src/plugins/designer/formeditorw.h b/src/plugins/designer/formeditorw.h index b2627a1c6b8..2ae78a8000b 100644 --- a/src/plugins/designer/formeditorw.h +++ b/src/plugins/designer/formeditorw.h @@ -44,6 +44,7 @@ class QDesignerFormWindowInterface; class QAction; class QActionGroup; +class QMenu; class QSignalMapper; class QSettings; class QToolBar; @@ -122,6 +123,7 @@ private slots: void currentEditorChanged(Core::IEditor *editor); void toolChanged(int); void print(); + void setPreviewMenuEnabled(bool e); void updateShortcut(QObject *command); void closeFormEditorsForXmlEditors(QList<Core::IEditor*> editors); @@ -179,6 +181,7 @@ private: QAction *m_actionPrint; QAction *m_actionPreview; QActionGroup *m_actionGroupPreviewInStyle; + QMenu *m_previewInStyleMenu; QAction *m_actionAboutPlugins; QAction *m_modeActionSeparator; QSignalMapper *m_shortcutMapper; -- GitLab