QmlDesigner: Fix edit property dialog clipping issue

Task-number: QDS-11539
Change-Id: I32079b3778dc16bace63eeb29770e93f5def79e8
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Shrief Gabr
2024-01-15 09:24:47 +02:00
parent b47e074f62
commit 1085c6fd6b
2 changed files with 16 additions and 10 deletions

View File

@@ -18,7 +18,6 @@ Rectangle {
implicitWidth: 300 implicitWidth: 300
implicitHeight: 400 implicitHeight: 400
color: StudioTheme.Values.themeControlBackground color: StudioTheme.Values.themeControlBackground
ColumnLayout { ColumnLayout {
@@ -124,7 +123,7 @@ Rectangle {
tableView.model.selectColumn(index) tableView.model.selectColumn(index)
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
let posX = index === root.model.columnCount() - 1 ? parent.width - editProperyDialog.width : 0 let posX = index === root.model.columnCount() - 1 ? parent.width - editPropertyDialog.width : 0
headerMenu.clickedHeaderIndex = index headerMenu.clickedHeaderIndex = index
headerMenu.dialogPos = parent.mapToGlobal(posX, parent.height) headerMenu.dialogPos = parent.mapToGlobal(posX, parent.height)
@@ -159,8 +158,8 @@ Rectangle {
StudioControls.MenuItem { StudioControls.MenuItem {
text: qsTr("Edit") text: qsTr("Edit")
onTriggered: editProperyDialog.openDialog(headerMenu.clickedHeaderIndex, onTriggered: editPropertyDialog.openDialog(headerMenu.clickedHeaderIndex,
headerMenu.dialogPos) headerMenu.dialogPos)
} }
StudioControls.MenuItem { StudioControls.MenuItem {
@@ -476,10 +475,15 @@ Rectangle {
} }
EditPropertyDialog { EditPropertyDialog {
id: editProperyDialog id: editPropertyDialog
model: root.model model: root.model
} }
Connections {
target: root.parent
onIsHorizontalChanged: editPropertyDialog.close()
}
StudioControls.Dialog { StudioControls.Dialog {
id: deleteColumnDialog id: deleteColumnDialog

View File

@@ -36,6 +36,11 @@ StudioControls.Dialog {
root.open() root.open()
} }
onWidthChanged: {
if (visible && x > parent.width)
root.close()
}
onAccepted: { onAccepted: {
if (nameTextField.text !== "" && nameTextField.text !== root.__currentName) if (nameTextField.text !== "" && nameTextField.text !== root.__currentName)
root.model.renameColumn(root.__propertyIndex, nameTextField.text) root.model.renameColumn(root.__propertyIndex, nameTextField.text)
@@ -50,13 +55,13 @@ StudioControls.Dialog {
Grid { Grid {
columns: 2 columns: 2
rows: 2 rows: 2
spacing: 2 rowSpacing: 2
columnSpacing: 25
verticalItemAlignment: Grid.AlignVCenter verticalItemAlignment: Grid.AlignVCenter
Text { Text {
text: qsTr("Name") text: qsTr("Name")
color: StudioTheme.Values.themeTextColor color: StudioTheme.Values.themeTextColor
width: 50
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@@ -129,14 +134,12 @@ StudioControls.Dialog {
Row { Row {
height: 40 height: 40
spacing: 5 spacing: 5
anchors.right: parent.right
HelperWidgets.Button { HelperWidgets.Button {
id: editButton id: editButton
text: qsTr("Apply") text: qsTr("Apply")
enabled: nameTextField.text !== "" enabled: nameTextField.text !== ""
width: 70
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
onClicked: root.accept() onClicked: root.accept()
@@ -145,7 +148,6 @@ StudioControls.Dialog {
HelperWidgets.Button { HelperWidgets.Button {
text: qsTr("Cancel") text: qsTr("Cancel")
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: 70
onClicked: root.reject() onClicked: root.reject()
} }