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
@@ -37,6 +37,10 @@
|
||||
#include "qmljssemanticinfoupdater.h"
|
||||
#include "qmloutlinemodel.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
|
||||
#include <qmljstools/qmljsindenter.h>
|
||||
#include <qmljstools/qmljsmodelmanager.h>
|
||||
#include <qmljstools/qmljsqtstylecodeformatter.h>
|
||||
@@ -520,6 +524,19 @@ void QmlJSEditorDocumentPrivate::acceptNewSemanticInfo(const SemanticInfo &seman
|
||||
m_outlineModelNeedsUpdate = 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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user