QmlDesigner: Polish the ui of the Model Editor

- The main toolbar of the Model editor is aligned with the rest
  of the ui
- Update/Save icon is updated
- Tooltips for save and export actions are modified
- Minimum size for the Model editor is applied

Fixes: QDS-11449
Fixes: QDS-11244
Change-Id: Ice389ae439ac855eb3a5d3197a2365e6d2506a90
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:
Ali Kianian
2023-11-29 17:30:31 +02:00
parent 6e566bac27
commit 70f9e35c62
3 changed files with 18 additions and 14 deletions

View File

@@ -99,15 +99,15 @@ Item {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
IconButton { IconButton {
icon: StudioTheme.Constants.updateContent_medium icon: StudioTheme.Constants.save_medium
tooltip: qsTr("Update existing file with changes") tooltip: qsTr("Save changes")
enabled: root.model.collectionName !== "" enabled: root.model.collectionName !== ""
onClicked: root.model.saveCurrentCollection() onClicked: root.model.saveCurrentCollection()
} }
IconButton { IconButton {
icon: StudioTheme.Constants.export_medium icon: StudioTheme.Constants.export_medium
tooltip: qsTr("Export the model to a new file") tooltip: qsTr("Export model")
enabled: root.model.collectionName !== "" enabled: root.model.collectionName !== ""
onClicked: fileDialog.open() onClicked: fileDialog.open()
} }

View File

@@ -55,32 +55,35 @@ Item {
ColumnLayout { ColumnLayout {
id: collectionsSideBar id: collectionsSideBar
spacing: 0
Layout.alignment: Qt.AlignTop | Qt.AlignLeft Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.minimumWidth: 300 Layout.minimumWidth: 300
Layout.fillWidth: !grid.isHorizontal Layout.fillWidth: !grid.isHorizontal
RowLayout { Rectangle {
spacing: StudioTheme.Values.sectionRowSpacing color: StudioTheme.Values.themeToolbarBackground
Layout.preferredHeight: StudioTheme.Values.toolbarHeight
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 50
Text { Text {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true anchors.left: parent.left
anchors.leftMargin: StudioTheme.Values.toolbarHorizontalMargin
text: qsTr("Data Models") text: qsTr("Data Models")
font.pixelSize: StudioTheme.Values.baseFontSize font.pixelSize: StudioTheme.Values.baseFontSize
color: StudioTheme.Values.themeTextColor color: StudioTheme.Values.themeTextColor
leftPadding: 15
} }
HelperWidgets.IconButton { HelperWidgets.AbstractButton {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: StudioTheme.Values.toolbarHorizontalMargin
icon: StudioTheme.Constants.import_medium style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.import_medium
tooltip: qsTr("Import a model") tooltip: qsTr("Import a model")
radius: StudioTheme.Values.smallRadius
onClicked: importDialog.open() onClicked: importDialog.open()
} }
@@ -117,7 +120,7 @@ Item {
HelperWidgets.IconButton { HelperWidgets.IconButton {
id: addCollectionButton id: addCollectionButton
iconSize:16 iconSize: 16
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 24 Layout.minimumWidth: 24
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter

View File

@@ -61,6 +61,7 @@ QmlDesigner::WidgetInfo CollectionView::widgetInfo()
{ {
if (m_widget.isNull()) { if (m_widget.isNull()) {
m_widget = new CollectionWidget(this); m_widget = new CollectionWidget(this);
m_widget->setMinimumSize(m_widget->minimumSizeHint());
auto collectionEditorContext = new Internal::CollectionEditorContext(m_widget.data()); auto collectionEditorContext = new Internal::CollectionEditorContext(m_widget.data());
Core::ICore::addContextObject(collectionEditorContext); Core::ICore::addContextObject(collectionEditorContext);