forked from qt-creator/qt-creator
QmlDesigner.designModeWidget: fix
Using a QWeakPointer for m_textEditor, since the texteditor might be deleted if the document was closed. Moving the NavigationHistory handling upwards. Change-Id: Ib5c14d6cd139490379cc2bf76d5440720c5664bc Reviewed-on: http://codereview.qt.nokia.com/526 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
@@ -185,7 +185,6 @@ void DocumentWarningWidget::goToError()
|
|||||||
DesignModeWidget::DesignModeWidget(QWidget *parent) :
|
DesignModeWidget::DesignModeWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_syncWithTextEdit(false),
|
m_syncWithTextEdit(false),
|
||||||
m_textEditor(0),
|
|
||||||
m_mainSplitter(0),
|
m_mainSplitter(0),
|
||||||
m_leftSideBar(0),
|
m_leftSideBar(0),
|
||||||
m_rightSideBar(0),
|
m_rightSideBar(0),
|
||||||
@@ -271,8 +270,12 @@ void DesignModeWidget::toggleSidebars()
|
|||||||
void DesignModeWidget::showEditor(Core::IEditor *editor)
|
void DesignModeWidget::showEditor(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
if (m_textEditor && editor)
|
if (m_textEditor && editor)
|
||||||
if (m_textEditor->file()->fileName() == editor->file()->fileName())
|
if (m_textEditor->file()->fileName() != editor->file()->fileName()) {
|
||||||
return;
|
if (!m_keepNavigatorHistory)
|
||||||
|
addNavigatorHistoryEntry(editor->file()->fileName());
|
||||||
|
setupNavigatorHistory();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prevent recursive calls to function by explicitly managing initialization status
|
// Prevent recursive calls to function by explicitly managing initialization status
|
||||||
// (QApplication::processEvents is called explicitly at a number of places)
|
// (QApplication::processEvents is called explicitly at a number of places)
|
||||||
@@ -295,9 +298,6 @@ void DesignModeWidget::showEditor(Core::IEditor *editor)
|
|||||||
textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
|
textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
|
||||||
if (textEditor)
|
if (textEditor)
|
||||||
m_fakeToolBar->addEditor(textEditor);
|
m_fakeToolBar->addEditor(textEditor);
|
||||||
if (!m_keepNavigatorHistory)
|
|
||||||
addNavigatorHistoryEntry(fileName);
|
|
||||||
setupNavigatorHistory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
void saveSettings();
|
void saveSettings();
|
||||||
void setAutoSynchronization(bool sync);
|
void setAutoSynchronization(bool sync);
|
||||||
|
|
||||||
TextEditor::ITextEditor *textEditor() const {return m_textEditor; }
|
TextEditor::ITextEditor *textEditor() const {return m_textEditor.data(); }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void undo();
|
void undo();
|
||||||
@@ -200,7 +200,7 @@ private:
|
|||||||
void setupNavigatorHistory();
|
void setupNavigatorHistory();
|
||||||
void addNavigatorHistoryEntry(const QString &fileName);
|
void addNavigatorHistoryEntry(const QString &fileName);
|
||||||
|
|
||||||
TextEditor::ITextEditor *m_textEditor;
|
QWeakPointer<TextEditor::ITextEditor> m_textEditor;
|
||||||
|
|
||||||
QSplitter *m_mainSplitter;
|
QSplitter *m_mainSplitter;
|
||||||
Core::SideBar *m_leftSideBar;
|
Core::SideBar *m_leftSideBar;
|
||||||
|
|||||||
Reference in New Issue
Block a user