diff options
author | Samuel Ghinet <samuel.ghinet@qt.io> | 2021-12-01 19:30:34 +0200 |
---|---|---|
committer | Samuel Ghinet <samuel.ghinet@qt.io> | 2021-12-08 13:05:55 +0000 |
commit | 8c139603a18ef3efff5ff46de9cac488b3e93bfa (patch) | |
tree | 306259b058c8a05421cd56e43f69660faec4a536 | |
parent | 44ff85cb1b5173adfb611e36854400e3c2174bee (diff) |
QDS: shrink the right margin of the project view for small sized dialog
This also allows a bit smaller minimum width for the dialog.
Also, did a bit of cleanup.
Task-number: QDS-5500
Change-Id: I3660190ac0a73dd1da1c7d6f8ee76660b1fba6be
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
4 files changed, 26 insertions, 13 deletions
diff --git a/share/qtcreator/qmldesigner/newprojectdialog/NewProjectDialog.qml b/share/qtcreator/qmldesigner/newprojectdialog/NewProjectDialog.qml index eb0cb21adf..3e91ab70f1 100644 --- a/share/qtcreator/qmldesigner/newprojectdialog/NewProjectDialog.qml +++ b/share/qtcreator/qmldesigner/newprojectdialog/NewProjectDialog.qml @@ -133,7 +133,7 @@ Item { Rectangle { // TabBar readonly property int animDur: 500 - id: samTabRect + id: tabBar x: 10 // left padding width: parent.width - 64 // right padding height: DialogValues.projectViewHeaderHeight @@ -153,15 +153,15 @@ Item { verticalAlignment: Text.AlignVCenter color: tabBarRow.currIndex === index ? DialogValues.textColorInteraction : DialogValues.textColor - Behavior on color { ColorAnimation { duration: samTabRect.animDur } } + Behavior on color { ColorAnimation { duration: tabBar.animDur } } MouseArea { anchors.fill: parent onClicked: { tabBarRow.currIndex = index projectModel.setPage(index) - projectViewId.currentIndex = 0 - projectViewId.currentIndexChanged() + projectView.currentIndex = 0 + projectView.currentIndexChanged() strip.x = parent.x strip.width = parent.width @@ -180,13 +180,26 @@ Item { color: DialogValues.textColorInteraction anchors.bottom: parent.bottom - Behavior on x { SmoothedAnimation { duration: samTabRect.animDur } } - Behavior on width { SmoothedAnimation { duration: strip.width === 0 ? 0 : samTabRect.animDur } } // do not animate initial width + Behavior on x { SmoothedAnimation { duration: tabBar.animDur } } + Behavior on width { SmoothedAnimation { duration: strip.width === 0 ? 0 : tabBar.animDur } } // do not animate initial width + } + + Connections { + target: rootDialog + function onWidthChanged() { + if (rootDialog.width < 1200) { // 1200 = the width threshold + tabBar.width = tabBar.parent.width - 20 + projectView.width = projectView.parent.width - 20 + } else { + tabBar.width = tabBar.parent.width - 64 + projectView.width = projectView.parent.width - 64 + } + } } } // Rectangle NewProjectView { - id: projectViewId + id: projectView x: 10 // left padding width: parent.width - 64 // right padding height: DialogValues.projectViewHeight @@ -196,9 +209,9 @@ Item { target: rootDialog function onHeightChanged() { if (rootDialog.height < 700) { // 700 = minimum height big dialog - projectViewId.height = DialogValues.projectViewHeight / 2 + projectView.height = DialogValues.projectViewHeight / 2 } else { - projectViewId.height = DialogValues.projectViewHeight + projectView.height = DialogValues.projectViewHeight } } } @@ -213,7 +226,7 @@ Item { lineHeight: DialogValues.defaultLineHeight lineHeightMode: Text.FixedHeight leftPadding: 14 - width: projectViewId.width + width: projectView.width color: DialogValues.textColor wrapMode: Text.WordWrap maximumLineCount: 4 diff --git a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/DialogValues.qml b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/DialogValues.qml index 0dafb43e44..b99b99dc95 100644 --- a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/DialogValues.qml +++ b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/DialogValues.qml @@ -35,7 +35,7 @@ QtObject { readonly property int projectViewMinimumHeight: projectViewHeight readonly property int dialogContentHeight: projectViewHeight + 300 // i.e. dialog without header and footer readonly property int loadedPanesWidth: detailsPaneWidth + stylesPaneWidth - readonly property int detailsPaneWidth: 330 + detailsPanePadding * 2// + 10 // 50 + readonly property int detailsPaneWidth: 330 + detailsPanePadding * 2 readonly property int dialogTitleTextHeight: 47 /* detailsScrollableContentHeight - the full height that may need to be scrolled to be fully visible, if the dialog box is too small. */ diff --git a/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp b/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp index 0e50292504..e14678431a 100644 --- a/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp +++ b/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp @@ -96,7 +96,7 @@ QPixmap NewProjectDialogImageProvider::requestDefaultPixmap(const QString &id, Q } if (pixmap.isNull()) - return QPixmap{}; + return {}; if (requestedSize.isValid()) return pixmap.scaled(requestedSize); diff --git a/src/plugins/studiowelcome/qdsnewdialog.cpp b/src/plugins/studiowelcome/qdsnewdialog.cpp index 1ab2a45ee8..50e3a085ca 100644 --- a/src/plugins/studiowelcome/qdsnewdialog.cpp +++ b/src/plugins/studiowelcome/qdsnewdialog.cpp @@ -94,7 +94,7 @@ QdsNewDialog::QdsNewDialog(QWidget *parent) m_dialog->setWindowModality(Qt::ApplicationModal); m_dialog->setWindowFlags(Qt::Dialog); m_dialog->setAttribute(Qt::WA_DeleteOnClose); - m_dialog->setMinimumSize(1110, 554); + m_dialog->setMinimumSize(1066, 554); QSize screenSize = m_dialog->screen()->geometry().size(); if (screenSize.height() < 1080) |