forked from qt-creator/qt-creator
QmlDesigner: Fix Type error in rename dialog
* Remove import versions
* Add correct type to Dialog enums in order for them to be resolved
correctly, otherwise this error comes up: "TypeError: Value is null
and could not be converted to an object"
* Improve if statement assignment
Change-Id: I2c593a6a07e6aa5aa7af88413249d991074710fe
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
(cherry picked from commit e300842d4b
)
This commit is contained in:
committed by
Henning Gründl
parent
b2abc6fa8e
commit
6e155ce0a9
@@ -26,8 +26,8 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls.Basic as Basic
|
import QtQuick.Controls.Basic as Basic
|
||||||
import StatesEditor
|
import StatesEditor
|
||||||
import HelperWidgets 2.0 as HelperWidgets
|
import HelperWidgets as HelperWidgets
|
||||||
import StudioControls 1.0 as StudioControls
|
import StudioControls as StudioControls
|
||||||
import StudioTheme as StudioTheme
|
import StudioTheme as StudioTheme
|
||||||
import StatesEditorBackend
|
import StatesEditorBackend
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ Rectangle {
|
|||||||
StudioControls.Dialog {
|
StudioControls.Dialog {
|
||||||
id: editDialog
|
id: editDialog
|
||||||
title: qsTr("Rename state group")
|
title: qsTr("Rename state group")
|
||||||
standardButtons: Dialog.Apply | Dialog.Cancel
|
standardButtons: Basic.Dialog.Apply | Basic.Dialog.Cancel
|
||||||
x: editButton.x - Math.max(0, editButton.x + editDialog.width - root.width)
|
x: editButton.x - Math.max(0, editButton.x + editDialog.width - root.width)
|
||||||
y: toolBar.height
|
y: toolBar.height
|
||||||
width: Math.min(300, root.width)
|
width: Math.min(300, root.width)
|
||||||
@@ -328,15 +328,11 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
let btn = editDialog.standardButton(Dialog.Apply)
|
let btn = editDialog.standardButton(Basic.Dialog.Apply)
|
||||||
if (!btn)
|
if (!btn)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (editDialog.previousString !== editTextField.text) {
|
btn.enabled = (editDialog.previousString !== editTextField.text)
|
||||||
btn.enabled = true
|
|
||||||
} else {
|
|
||||||
btn.enabled = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: editDialog.accept()
|
onAccepted: editDialog.accept()
|
||||||
@@ -355,7 +351,7 @@ Rectangle {
|
|||||||
editTextField.text = StatesEditorBackend.statesEditorModel.activeStateGroup
|
editTextField.text = StatesEditorBackend.statesEditorModel.activeStateGroup
|
||||||
editDialog.previousString = StatesEditorBackend.statesEditorModel.activeStateGroup
|
editDialog.previousString = StatesEditorBackend.statesEditorModel.activeStateGroup
|
||||||
|
|
||||||
let btn = editDialog.standardButton(Dialog.Apply)
|
let btn = editDialog.standardButton(Basic.Dialog.Apply)
|
||||||
btn.enabled = false
|
btn.enabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user