forked from qt-creator/qt-creator
QmlDesigner: deactivate use of F4 to switch in design mode
Introduce a setting for a not implemented in design text edit. Change-Id: Ie4973ec4fcb2c9b2e2534e40187cf33a0202abaa Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
@@ -60,6 +60,7 @@ const char FORWARD_PUPPET_OUTPUT[] = "ForwardPuppetOutput";
|
||||
const char REFORMAT_UI_QML_FILES[] = "ReformatUiQmlFiles"; /* This Setting is not exposed in ui.
|
||||
The setting can be used to turn off the feature,
|
||||
if there are serious issues */
|
||||
const char TEXTEDIT_IN_DESIGNMODE[] = "TextEditInDesignMode";
|
||||
}
|
||||
|
||||
class DesignerSettings : public QHash<QByteArray, QVariant>
|
||||
|
@@ -130,6 +130,12 @@ static bool shouldAssertInException()
|
||||
return !processEnvironment.value("QMLDESIGNER_ASSERT_ON_EXCEPTION").isEmpty();
|
||||
}
|
||||
|
||||
static bool useTextEditInDesignMode()
|
||||
{
|
||||
DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
|
||||
return settings.value(DesignerSettingsKey::TEXTEDIT_IN_DESIGNMODE, false).toBool();
|
||||
}
|
||||
|
||||
static bool warningsForQmlFilesInsteadOfUiQmlEnabled()
|
||||
{
|
||||
DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
|
||||
@@ -208,12 +214,11 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
|
||||
createDesignModeWidget();
|
||||
connect(switchTextDesignAction, &QAction::triggered, this, [](){
|
||||
if (Core::ModeManager::currentMode() == Core::Constants::MODE_EDIT) {
|
||||
Core::IEditor *editor = Core::EditorManager::currentEditor();
|
||||
if (checkIfEditorIsQtQuick(editor))
|
||||
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
|
||||
} else if (Core::ModeManager::currentMode() == Core::Constants::MODE_DESIGN) {
|
||||
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||
if (Core::ModeManager::currentMode() == Core::Constants::MODE_DESIGN) {
|
||||
if (useTextEditInDesignMode())
|
||||
qDebug() << "not implemented";
|
||||
else
|
||||
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user