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: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Samuel Ghinet
2021-12-01 19:30:34 +02:00
committed by Thomas Hartmann
parent af07324fb3
commit 3118a92479
4 changed files with 26 additions and 13 deletions

View File

@@ -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

View File

@@ -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. */

View File

@@ -96,7 +96,7 @@ QPixmap NewProjectDialogImageProvider::requestDefaultPixmap(const QString &id, Q
}
if (pixmap.isNull())
return QPixmap{};
return {};
if (requestedSize.isValid())
return pixmap.scaled(requestedSize);

View File

@@ -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)