forked from qt-creator/qt-creator
QmlDesigner: Disable widgets while text is edited manually
While the user is editing text in the text editor we disable the input widgets. This ensures that the rewriter is not confused by the manual editing and also there is no guarantee that the QML code is syntacially correct. We also disable the toolbar. Change-Id: If062b49f834e901a933a9b1f67582ee9be6232bc Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
68e3da84f3
commit
9624bf0508
@@ -40,6 +40,11 @@
|
||||
#include <modelnode.h>
|
||||
#include <nodeproperty.h>
|
||||
|
||||
#ifndef QMLDESIGNER_TEST
|
||||
#include <qmldesignerplugin.h>
|
||||
#include <viewmanager.h>
|
||||
#endif
|
||||
|
||||
#include <qmljs/parser/qmljsengine_p.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
#include <qmljs/qmljssimplereader.h>
|
||||
@@ -855,15 +860,17 @@ void RewriterView::qmlTextChanged()
|
||||
}
|
||||
|
||||
case Amend: {
|
||||
if (m_instantQmlTextUpdate)
|
||||
if (m_instantQmlTextUpdate) {
|
||||
amendQmlText();
|
||||
else
|
||||
} else {
|
||||
#ifndef QMLDESIGNER_TEST
|
||||
QmlDesignerPlugin::instance()->viewManager().disableWidgets();
|
||||
m_amendTimer.start(400);
|
||||
#else
|
||||
/*Keep test synchronous*/
|
||||
amendQmlText();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -360,15 +360,21 @@ QWidget *ViewManager::widget(const QString &uniqueId) const
|
||||
void ViewManager::disableWidgets()
|
||||
{
|
||||
foreach (const WidgetInfo &widgetInfo, widgetInfos())
|
||||
if (widgetInfo.widgetFlags == DesignerWidgetFlags::DisableOnError)
|
||||
if (widgetInfo.widgetFlags == DesignerWidgetFlags::DisableOnError) {
|
||||
widgetInfo.widget->setEnabled(false);
|
||||
if (auto parentWidget = widgetInfo.widget->parentWidget())
|
||||
parentWidget->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewManager::enableWidgets()
|
||||
{
|
||||
foreach (const WidgetInfo &widgetInfo, widgetInfos())
|
||||
if (widgetInfo.widgetFlags == DesignerWidgetFlags::DisableOnError)
|
||||
if (widgetInfo.widgetFlags == DesignerWidgetFlags::DisableOnError) {
|
||||
widgetInfo.widget->setEnabled(true);
|
||||
if (auto parentWidget = widgetInfo.widget->parentWidget())
|
||||
parentWidget->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewManager::pushFileOnCrumbleBar(const Utils::FileName &fileName)
|
||||
|
Reference in New Issue
Block a user