Commit f185097b authored by Marco Bubke's avatar Marco Bubke Committed by Thomas Hartmann
Browse files

QmlDesigner: Fix toolbar



Toolbar was not registered, so it did not work (close button, etc).

Change-Id: I4ad243602ac09f5a76752855d80d5732180233cf
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 2b128ac6
......@@ -256,7 +256,7 @@ void DesignModeWidget::showEditor(Core::IEditor *editor)
if (textEditor())
m_fakeToolBar->addEditor(textEditor());
m_toolBar->addEditor(textEditor());
setCurrentDesignDocument(currentDesignDocument());
......@@ -376,7 +376,7 @@ void DesignModeWidget::setup()
}
}
m_fakeToolBar = Core::EditorManager::createToolBar(this);
m_toolBar = Core::EditorManager::createToolBar(this);
m_mainSplitter = new MiniSplitter(this);
m_mainSplitter->setObjectName("mainSplitter");
......@@ -416,12 +416,11 @@ void DesignModeWidget::setup()
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
this, SLOT(deleteSidebarWidgets()));
m_fakeToolBar->setToolbarCreationFlags(Core::EditorToolBar::FlagsStandalone);
//m_fakeToolBar->addEditor(textEditor()); ### what does this mean?
m_fakeToolBar->setNavigationVisible(true);
m_toolBar->setToolbarCreationFlags(Core::EditorToolBar::FlagsStandalone);
m_toolBar->setNavigationVisible(true);
connect(m_fakeToolBar, SIGNAL(goForwardClicked()), this, SLOT(onGoForwardClicked()));
connect(m_fakeToolBar, SIGNAL(goBackClicked()), this, SLOT(onGoBackClicked()));
connect(m_toolBar, SIGNAL(goForwardClicked()), this, SLOT(toolBarOnGoForwardClicked()));
connect(m_toolBar, SIGNAL(goBackClicked()), this, SLOT(toolBarOnGoBackClicked()));
if (currentDesignDocument())
setupNavigatorHistory(currentDesignDocument()->textEditor());
......@@ -485,7 +484,7 @@ void DesignModeWidget::qmlPuppetCrashed()
showErrorMessage(errorList);
}
void DesignModeWidget::onGoBackClicked()
void DesignModeWidget::toolBarOnGoBackClicked()
{
if (m_navigatorHistoryCounter > 0) {
--m_navigatorHistoryCounter;
......@@ -495,7 +494,7 @@ void DesignModeWidget::onGoBackClicked()
}
}
void DesignModeWidget::onGoForwardClicked()
void DesignModeWidget::toolBarOnGoForwardClicked()
{
if (m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1)) {
++m_navigatorHistoryCounter;
......@@ -529,8 +528,9 @@ void DesignModeWidget::setupNavigatorHistory(Core::IEditor *editor)
const bool canGoBack = m_navigatorHistoryCounter > 0;
const bool canGoForward = m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1);
m_fakeToolBar->setCanGoBack(canGoBack);
m_fakeToolBar->setCanGoForward(canGoForward);
m_toolBar->setCanGoBack(canGoBack);
m_toolBar->setCanGoForward(canGoForward);
m_toolBar->setCurrentEditor(editor);
}
void DesignModeWidget::addNavigatorHistoryEntry(const QString &fileName)
......@@ -550,7 +550,7 @@ QWidget *DesignModeWidget::createCenterWidget()
QVBoxLayout *rightLayout = new QVBoxLayout(centerWidget);
rightLayout->setMargin(0);
rightLayout->setSpacing(0);
rightLayout->addWidget(m_fakeToolBar);
rightLayout->addWidget(m_toolBar);
//### we now own these here
rightLayout->addWidget(viewManager().statesEditorWidget());
......
......@@ -119,6 +119,8 @@ public:
DesignDocument *currentDesignDocument() const;
ViewManager &viewManager();
void setupNavigatorHistory(Core::IEditor *editor);
void enableWidgets();
void disableWidgets();
void showErrorMessage(const QList<RewriterView::Error> &errors);
......@@ -137,8 +139,8 @@ private slots:
void deleteSidebarWidgets();
void qmlPuppetCrashed();
void onGoBackClicked();
void onGoForwardClicked();
void toolBarOnGoBackClicked();
void toolBarOnGoForwardClicked();
protected:
void resizeEvent(QResizeEvent *event);
......@@ -150,7 +152,6 @@ private: // functions
void setup();
bool isInNodeDefinition(int nodeOffset, int nodeLength, int cursorPos) const;
QmlDesigner::ModelNode nodeForPosition(int cursorPos) const;
void setupNavigatorHistory(Core::IEditor *editor);
void addNavigatorHistoryEntry(const QString &fileName);
QWidget *createCenterWidget();
......@@ -158,7 +159,7 @@ private: // variables
QSplitter *m_mainSplitter;
Core::SideBar *m_leftSideBar;
Core::SideBar *m_rightSideBar;
Core::EditorToolBar *m_fakeToolBar;
Core::EditorToolBar *m_toolBar;
Core::OutputPanePlaceHolder *m_outputPanePlaceholder;
Core::MiniSplitter *m_outputPlaceholderSplitter;
QList<Core::SideBarItem*> m_sideBarItems;
......
......@@ -298,6 +298,7 @@ void QmlDesignerPlugin::activateAutoSynchronization()
if (errors.isEmpty()) {
selectModelNodeUnderTextCursor();
m_mainWidget->enableWidgets();
m_mainWidget->setupNavigatorHistory(currentDesignDocument()->textEditor());
} else {
m_mainWidget->disableWidgets();
m_mainWidget->showErrorMessage(errors);
......
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