forked from qt-creator/qt-creator
QmlDesigner: Prevent clipping the CollectionDetailsView delegates
Task-number: QDS-11011 Change-Id: I7e7997df09c8c62c72a911a3f51a9b9fe492010b Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -6,84 +6,144 @@ import CollectionDetails 1.0 as CollectionDetails
|
|||||||
import HelperWidgets 2.0 as HelperWidgets
|
import HelperWidgets 2.0 as HelperWidgets
|
||||||
import StudioControls 1.0 as StudioControls
|
import StudioControls 1.0 as StudioControls
|
||||||
import StudioTheme 1.0 as StudioTheme
|
import StudioTheme 1.0 as StudioTheme
|
||||||
|
import QtQuick.Templates as T
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
required property var columnType
|
required property var columnType
|
||||||
|
|
||||||
property var __modifier : textEditor
|
property var __modifier : textEditor
|
||||||
|
property bool __changesAccepted: true
|
||||||
|
|
||||||
width: itemColumn.width
|
TableView.onCommit: {
|
||||||
height: itemColumn.height
|
if (root.__changesAccepted)
|
||||||
|
edit = __modifier.editor.editValue
|
||||||
TableView.onCommit: edit = __modifier.editValue
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
__changesAccepted = true
|
||||||
if (edit && edit !== "")
|
if (edit && edit !== "")
|
||||||
root.__modifier.editValue = edit
|
root.__modifier.editor.editValue = edit
|
||||||
}
|
}
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if (root.activeFocus)
|
if (root.activeFocus)
|
||||||
root.__modifier.forceActiveFocus()
|
root.__modifier.editor.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
id: modifierFocusConnection
|
id: modifierFocusConnection
|
||||||
target: root.__modifier
|
|
||||||
|
target: root.__modifier.editor
|
||||||
|
|
||||||
function onActiveFocusChanged() {
|
function onActiveFocusChanged() {
|
||||||
if (!modifierFocusConnection.target.activeFocus)
|
if (!modifierFocusConnection.target.activeFocus)
|
||||||
TableView.commit()
|
root.TableView.commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
EditorPopup {
|
||||||
id: itemColumn
|
|
||||||
|
|
||||||
StudioControls.TextField {
|
|
||||||
id: textEditor
|
id: textEditor
|
||||||
|
|
||||||
property alias editValue: textEditor.text
|
editor: textField
|
||||||
|
|
||||||
|
StudioControls.TextField {
|
||||||
|
id: textField
|
||||||
|
|
||||||
|
property alias editValue: textField.text
|
||||||
|
|
||||||
actionIndicator.visible: false
|
actionIndicator.visible: false
|
||||||
translationIndicatorVisible: false
|
translationIndicatorVisible: false
|
||||||
enabled: visible
|
|
||||||
visible: false
|
onRejected: root.__changesAccepted = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StudioControls.RealSpinBox {
|
EditorPopup {
|
||||||
id: numberEditor
|
id: numberEditor
|
||||||
|
|
||||||
property alias editValue: numberEditor.realValue
|
editor: numberField
|
||||||
|
|
||||||
|
StudioControls.RealSpinBox {
|
||||||
|
id: numberField
|
||||||
|
|
||||||
|
property alias editValue: numberField.realValue
|
||||||
|
|
||||||
actionIndicator.visible: false
|
actionIndicator.visible: false
|
||||||
enabled: visible
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
realFrom: -9e9
|
realFrom: -9e9
|
||||||
realTo: 9e9
|
realTo: 9e9
|
||||||
realStepSize: 1.0
|
realStepSize: 1.0
|
||||||
decimals: 6
|
decimals: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
StudioControls.CheckBox {
|
|
||||||
id: boolEditor
|
|
||||||
|
|
||||||
property alias editValue: boolEditor.checked
|
|
||||||
|
|
||||||
actionIndicatorVisible: false
|
|
||||||
enabled: visible
|
|
||||||
visible: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HelperWidgets.ColorPicker {
|
EditorPopup {
|
||||||
|
id: boolEditor
|
||||||
|
|
||||||
|
editor: boolField
|
||||||
|
|
||||||
|
StudioControls.CheckBox {
|
||||||
|
id: boolField
|
||||||
|
|
||||||
|
property alias editValue: boolField.checked
|
||||||
|
|
||||||
|
actionIndicatorVisible: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorPopup {
|
||||||
id: colorEditor
|
id: colorEditor
|
||||||
|
|
||||||
property alias editValue: colorEditor.color
|
editor: colorPicker
|
||||||
|
|
||||||
|
implicitHeight: colorPicker.height + topPadding + bottomPadding
|
||||||
|
implicitWidth: colorPicker.width + leftPadding + rightPadding
|
||||||
|
padding: 8
|
||||||
|
|
||||||
|
HelperWidgets.ColorPicker {
|
||||||
|
id: colorPicker
|
||||||
|
|
||||||
|
property alias editValue: colorPicker.color
|
||||||
|
|
||||||
width: 100
|
width: 100
|
||||||
|
|
||||||
|
Keys.onEnterPressed: colorPicker.focus = false
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: StudioTheme.Values.themeControlBackgroundInteraction
|
||||||
|
border.color: StudioTheme.Values.themeInteraction
|
||||||
|
border.width: StudioTheme.Values.border
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component EditorPopup: T.Popup {
|
||||||
|
id: editorPopup
|
||||||
|
|
||||||
|
required property Item editor
|
||||||
|
|
||||||
|
implicitHeight: contentHeight
|
||||||
|
implicitWidth: contentWidth
|
||||||
|
|
||||||
enabled: visible
|
enabled: visible
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: editorPopup.editor
|
||||||
|
|
||||||
|
function onActiveFocusChanged() {
|
||||||
|
if (!editorPopup.editor.activeFocus)
|
||||||
|
editorPopup.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: editorPopup.editor.Keys
|
||||||
|
|
||||||
|
function onEscapePressed() {
|
||||||
|
root.__changesAccepted = false
|
||||||
|
editorPopup.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user