forked from qt-creator/qt-creator
QmlDesigner: Add "Unsaved Changes" indicator to Save button
Task-number: QDS-12237 Change-Id: Ib210ca06e061e82824ff4398604a569af44c2f6d Reviewed-by: Ali Kianian <ali.kianian@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -17,6 +17,7 @@ Rectangle {
|
|||||||
required property var model
|
required property var model
|
||||||
required property var backend
|
required property var backend
|
||||||
property int selectedRow: -1
|
property int selectedRow: -1
|
||||||
|
property bool hasUnsavedChanges: false
|
||||||
|
|
||||||
implicitHeight: StudioTheme.Values.toolbarHeight
|
implicitHeight: StudioTheme.Values.toolbarHeight
|
||||||
color: StudioTheme.Values.themeToolbarBackground
|
color: StudioTheme.Values.themeToolbarBackground
|
||||||
@@ -34,6 +35,14 @@ Rectangle {
|
|||||||
fileDialog.reject()
|
fileDialog.reject()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.model
|
||||||
|
|
||||||
|
function onDataChanged() {
|
||||||
|
hasUnsavedChanges = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: container
|
id: container
|
||||||
|
|
||||||
@@ -122,8 +131,18 @@ Rectangle {
|
|||||||
|
|
||||||
buttonIcon: StudioTheme.Constants.save_medium
|
buttonIcon: StudioTheme.Constants.save_medium
|
||||||
tooltip: qsTr("Save changes")
|
tooltip: qsTr("Save changes")
|
||||||
enabled: root.model.collectionName !== ""
|
enabled: root.model.collectionName !== "" && root.hasUnsavedChanges
|
||||||
onClicked: root.model.saveDataStoreCollections()
|
onClicked: hasUnsavedChanges = !root.model.saveDataStoreCollections()
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: StudioTheme.Values.smallStatusIndicatorDiameter
|
||||||
|
height: StudioTheme.Values.smallStatusIndicatorDiameter
|
||||||
|
radius: StudioTheme.Values.smallStatusIndicatorDiameter / 2
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
visible: hasUnsavedChanges
|
||||||
|
color: StudioTheme.Values.themeIconColorSelected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ QtObject {
|
|||||||
property real collectionTableVerticalMargin: 10
|
property real collectionTableVerticalMargin: 10
|
||||||
property real collectionCellMinimumWidth: 60
|
property real collectionCellMinimumWidth: 60
|
||||||
property real collectionCellMinimumHeight: 20
|
property real collectionCellMinimumHeight: 20
|
||||||
|
property real smallStatusIndicatorDiameter: 6
|
||||||
|
|
||||||
// NEW NEW NEW
|
// NEW NEW NEW
|
||||||
readonly property int flowMargin: 7
|
readonly property int flowMargin: 7
|
||||||
|
|||||||
Reference in New Issue
Block a user