forked from qt-creator/qt-creator
QML/JS: Fix that warnings about editing .ui.qml files accumulated
Splitting the editor would add the warning again. Since the warning is a document property, handle it in the document instead of the widgets. Change-Id: Ie20377b05dee14983f7ff46ba04ed2af2b737c96 Task-number: QTCREATORBUG-14923 Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
53e1c84f50
commit
78e8871207
@@ -58,7 +58,6 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <coreplugin/infobar.h>
|
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
@@ -112,7 +111,6 @@ QmlJSEditorWidget::QmlJSEditorWidget()
|
|||||||
{
|
{
|
||||||
m_outlineCombo = 0;
|
m_outlineCombo = 0;
|
||||||
m_contextPane = 0;
|
m_contextPane = 0;
|
||||||
m_firstSementicInfo = true;
|
|
||||||
m_findReferences = new FindReferences(this);
|
m_findReferences = new FindReferences(this);
|
||||||
|
|
||||||
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
|
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
|
||||||
@@ -949,16 +947,6 @@ void QmlJSEditorWidget::semanticInfoUpdated(const SemanticInfo &semanticInfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_firstSementicInfo) {
|
|
||||||
m_firstSementicInfo = false;
|
|
||||||
if (semanticInfo.document->language() == Dialect::QmlQtQuick2Ui) {
|
|
||||||
InfoBarEntry info(Id(Constants::QML_UI_FILE_WARNING),
|
|
||||||
tr("This file should only be edited in <b>Design</b> mode."));
|
|
||||||
info.setCustomButtonInfo(tr("Switch Mode"), []() { ModeManager::activateMode(Core::Constants::MODE_DESIGN); });
|
|
||||||
textDocument()->infoBar()->addInfo(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateUses();
|
updateUses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -139,8 +139,6 @@ private:
|
|||||||
int m_oldCursorPosition;
|
int m_oldCursorPosition;
|
||||||
|
|
||||||
FindReferences *m_findReferences;
|
FindReferences *m_findReferences;
|
||||||
|
|
||||||
bool m_firstSementicInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -37,6 +37,10 @@
|
|||||||
#include "qmljssemanticinfoupdater.h"
|
#include "qmljssemanticinfoupdater.h"
|
||||||
#include "qmloutlinemodel.h"
|
#include "qmloutlinemodel.h"
|
||||||
|
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <coreplugin/infobar.h>
|
||||||
|
#include <coreplugin/modemanager.h>
|
||||||
|
|
||||||
#include <qmljstools/qmljsindenter.h>
|
#include <qmljstools/qmljsindenter.h>
|
||||||
#include <qmljstools/qmljsmodelmanager.h>
|
#include <qmljstools/qmljsmodelmanager.h>
|
||||||
#include <qmljstools/qmljsqtstylecodeformatter.h>
|
#include <qmljstools/qmljsqtstylecodeformatter.h>
|
||||||
@@ -520,6 +524,19 @@ void QmlJSEditorDocumentPrivate::acceptNewSemanticInfo(const SemanticInfo &seman
|
|||||||
m_outlineModelNeedsUpdate = true;
|
m_outlineModelNeedsUpdate = true;
|
||||||
m_semanticHighlightingNecessary = true;
|
m_semanticHighlightingNecessary = true;
|
||||||
|
|
||||||
|
if (m_firstSementicInfo) {
|
||||||
|
m_firstSementicInfo = false;
|
||||||
|
if (semanticInfo.document->language() == Dialect::QmlQtQuick2Ui
|
||||||
|
&& !q->infoBar()->containsInfo(Core::Id(Constants::QML_UI_FILE_WARNING))) {
|
||||||
|
Core::InfoBarEntry info(Core::Id(Constants::QML_UI_FILE_WARNING),
|
||||||
|
tr("This file should only be edited in <b>Design</b> mode."));
|
||||||
|
info.setCustomButtonInfo(tr("Switch Mode"), []() {
|
||||||
|
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
|
||||||
|
});
|
||||||
|
q->infoBar()->addInfo(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
emit q->semanticInfoUpdated(m_semanticInfo); // calls triggerPendingUpdates as necessary
|
emit q->semanticInfoUpdated(m_semanticInfo); // calls triggerPendingUpdates as necessary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,6 +75,7 @@ public:
|
|||||||
Internal::SemanticHighlighter *m_semanticHighlighter;
|
Internal::SemanticHighlighter *m_semanticHighlighter;
|
||||||
bool m_semanticHighlightingNecessary;
|
bool m_semanticHighlightingNecessary;
|
||||||
bool m_outlineModelNeedsUpdate;
|
bool m_outlineModelNeedsUpdate;
|
||||||
|
bool m_firstSementicInfo = true;
|
||||||
QTimer m_updateOutlineModelTimer;
|
QTimer m_updateOutlineModelTimer;
|
||||||
Internal::QmlOutlineModel *m_outlineModel;
|
Internal::QmlOutlineModel *m_outlineModel;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user