forked from qt-creator/qt-creator
New Project dialog fix: "Orientation" button doesn't work for equal sizes
If the width equaled the height, for the project, then the orientation button didn't change visual state, when clicked. Also, renamed some fields in qml from "project" to "preset", because they actually refer to the preset, not to the project to be created. Task-number: QDS-5925 Change-Id: Ia776b24e0bf29a4bdf0e2f9f6ff26e5c0137ba4f Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -163,14 +163,14 @@ Item {
|
|||||||
id: tabBar
|
id: tabBar
|
||||||
x: 10 // left padding
|
x: 10 // left padding
|
||||||
width: parent.width - 20 // right padding
|
width: parent.width - 20 // right padding
|
||||||
height: DialogValues.projectViewHeaderHeight
|
height: DialogValues.presetViewHeaderHeight
|
||||||
color: DialogValues.lightPaneColor
|
color: DialogValues.lightPaneColor
|
||||||
|
|
||||||
function selectTab(tabIndex, selectLast = false) {
|
function selectTab(tabIndex, selectLast = false) {
|
||||||
var item = repeater.itemAt(tabIndex)
|
var item = repeater.itemAt(tabIndex)
|
||||||
tabBarRow.currIndex = tabIndex
|
tabBarRow.currIndex = tabIndex
|
||||||
|
|
||||||
projectView.selectLast = selectLast
|
presetView.selectLast = selectLast
|
||||||
BackendApi.presetModel.setPage(tabIndex) // NOTE: it resets preset model
|
BackendApi.presetModel.setPage(tabIndex) // NOTE: it resets preset model
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,10 +244,10 @@ Item {
|
|||||||
} // Rectangle
|
} // Rectangle
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: projectViewFrame
|
id: presetViewFrame
|
||||||
x: 10 // left padding
|
x: 10 // left padding
|
||||||
width: parent.width - 20 // right padding
|
width: parent.width - 20 // right padding
|
||||||
height: DialogValues.projectViewHeight
|
height: DialogValues.presetViewHeight
|
||||||
color: DialogValues.darkPaneColor
|
color: DialogValues.darkPaneColor
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -255,7 +255,7 @@ Item {
|
|||||||
anchors.margins: DialogValues.gridMargins
|
anchors.margins: DialogValues.gridMargins
|
||||||
|
|
||||||
NewProjectView {
|
NewProjectView {
|
||||||
id: projectView
|
id: presetView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
loader: projectDetailsLoader
|
loader: projectDetailsLoader
|
||||||
@@ -265,12 +265,12 @@ Item {
|
|||||||
target: rootDialog
|
target: rootDialog
|
||||||
function onHeightChanged() {
|
function onHeightChanged() {
|
||||||
if (rootDialog.height < 720) { // 720 = minimum height big dialog
|
if (rootDialog.height < 720) { // 720 = minimum height big dialog
|
||||||
DialogValues.projectViewHeight =
|
DialogValues.presetViewHeight =
|
||||||
DialogValues.projectItemHeight
|
DialogValues.presetItemHeight
|
||||||
+ 2 * DialogValues.gridMargins
|
+ 2 * DialogValues.gridMargins
|
||||||
} else {
|
} else {
|
||||||
DialogValues.projectViewHeight =
|
DialogValues.presetViewHeight =
|
||||||
DialogValues.projectItemHeight * 2
|
DialogValues.presetItemHeight * 2
|
||||||
+ DialogValues.gridSpacing
|
+ DialogValues.gridSpacing
|
||||||
+ 2 * DialogValues.gridMargins
|
+ 2 * DialogValues.gridMargins
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,7 @@ Item {
|
|||||||
lineHeight: DialogValues.defaultLineHeight
|
lineHeight: DialogValues.defaultLineHeight
|
||||||
lineHeightMode: Text.FixedHeight
|
lineHeightMode: Text.FixedHeight
|
||||||
leftPadding: 14
|
leftPadding: 14
|
||||||
width: projectViewFrame.width
|
width: presetViewFrame.width
|
||||||
color: DialogValues.textColor
|
color: DialogValues.textColor
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
maximumLineCount: 4
|
maximumLineCount: 4
|
||||||
|
@@ -371,6 +371,9 @@ Item {
|
|||||||
if (widthField.realValue && heightField.realValue) {
|
if (widthField.realValue && heightField.realValue) {
|
||||||
[widthField.realValue, heightField.realValue] = [heightField.realValue, widthField.realValue]
|
[widthField.realValue, heightField.realValue] = [heightField.realValue, widthField.realValue]
|
||||||
orientationButton.checked = !orientationButton.checked
|
orientationButton.checked = !orientationButton.checked
|
||||||
|
|
||||||
|
if (widthField.realValue === heightField.realValue)
|
||||||
|
orientationButton.checked ? setVertical() : setHorizontal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,9 +33,9 @@ QtObject {
|
|||||||
|
|
||||||
readonly property int dialogWidth: 1522
|
readonly property int dialogWidth: 1522
|
||||||
readonly property int dialogHeight: 940
|
readonly property int dialogHeight: 940
|
||||||
readonly property int projectViewMinimumWidth: 600
|
readonly property int presetViewMinimumWidth: 600
|
||||||
readonly property int projectViewMinimumHeight: root.gridCellHeight
|
readonly property int presetViewMinimumHeight: root.gridCellHeight
|
||||||
readonly property int dialogContentHeight: root.projectViewHeight + 300 // i.e. dialog without header and footer
|
readonly property int dialogContentHeight: root.presetViewHeight + 300 // i.e. dialog without header and footer
|
||||||
readonly property int loadedPanesWidth: root.detailsPaneWidth + root.stylesPaneWidth
|
readonly property int loadedPanesWidth: root.detailsPaneWidth + root.stylesPaneWidth
|
||||||
readonly property int detailsPaneWidth: 330 + root.detailsPanePadding * 2
|
readonly property int detailsPaneWidth: 330 + root.detailsPanePadding * 2
|
||||||
readonly property int dialogTitleTextHeight: 85
|
readonly property int dialogTitleTextHeight: 85
|
||||||
@@ -62,14 +62,14 @@ QtObject {
|
|||||||
readonly property int styleTextHeight: 18
|
readonly property int styleTextHeight: 18
|
||||||
|
|
||||||
readonly property int footerHeight: 73
|
readonly property int footerHeight: 73
|
||||||
readonly property int projectItemWidth: 136
|
readonly property int presetItemWidth: 136
|
||||||
readonly property int projectItemHeight: 110
|
readonly property int presetItemHeight: 110
|
||||||
property int projectViewHeight: root.projectItemHeight * 2 + root.gridSpacing + root.gridMargins * 2
|
property int presetViewHeight: root.presetItemHeight * 2 + root.gridSpacing + root.gridMargins * 2
|
||||||
readonly property int projectViewHeaderHeight: 38
|
readonly property int presetViewHeaderHeight: 38
|
||||||
|
|
||||||
readonly property int gridMargins: 20
|
readonly property int gridMargins: 20
|
||||||
readonly property int gridCellWidth: root.projectItemWidth + root.gridSpacing
|
readonly property int gridCellWidth: root.presetItemWidth + root.gridSpacing
|
||||||
readonly property int gridCellHeight: root.projectItemHeight + root.gridSpacing
|
readonly property int gridCellHeight: root.presetItemHeight + root.gridSpacing
|
||||||
readonly property int gridSpacing: 2
|
readonly property int gridSpacing: 2
|
||||||
|
|
||||||
readonly property int dialogButtonWidth: 100
|
readonly property int dialogButtonWidth: 100
|
||||||
|
@@ -97,8 +97,8 @@ ScrollView {
|
|||||||
|
|
||||||
property bool hover: delegate.hovered || removeMouseArea.containsMouse
|
property bool hover: delegate.hovered || removeMouseArea.containsMouse
|
||||||
|
|
||||||
width: DialogValues.projectItemWidth
|
width: DialogValues.presetItemWidth
|
||||||
height: DialogValues.projectItemHeight
|
height: DialogValues.presetItemHeight
|
||||||
|
|
||||||
onClicked: delegate.GridView.view.currentIndex = index
|
onClicked: delegate.GridView.view.currentIndex = index
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ ScrollView {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
color: delegate.hover ? scrollView.backgroundHoverColor : "transparent"
|
color: delegate.hover ? scrollView.backgroundHoverColor : "transparent"
|
||||||
border.color: delegate.hover ? projectTypeName.color : "transparent"
|
border.color: delegate.hover ? presetName.color : "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
function fontIconCode(index) {
|
function fontIconCode(index) {
|
||||||
@@ -125,7 +125,7 @@ ScrollView {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: projectTypeIcon
|
id: presetIcon
|
||||||
text: delegate.fontIconCode(index)
|
text: delegate.fontIconCode(index)
|
||||||
color: DialogValues.textColor
|
color: DialogValues.textColor
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
@@ -137,25 +137,25 @@ ScrollView {
|
|||||||
} // Preset type icon Label
|
} // Preset type icon Label
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: projectTypeName
|
id: presetName
|
||||||
color: DialogValues.textColor
|
color: DialogValues.textColor
|
||||||
text: name
|
text: name
|
||||||
font.pixelSize: DialogValues.defaultPixelSize
|
font.pixelSize: DialogValues.defaultPixelSize
|
||||||
lineHeight: DialogValues.defaultLineHeight
|
lineHeight: DialogValues.defaultLineHeight
|
||||||
lineHeightMode: Text.FixedHeight
|
lineHeightMode: Text.FixedHeight
|
||||||
width: DialogValues.projectItemWidth - 16
|
width: DialogValues.presetItemWidth - 16
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignTop
|
verticalAlignment: Text.AlignTop
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.preferredWidth: projectTypeName.width
|
Layout.preferredWidth: presetName.width
|
||||||
Layout.minimumWidth: projectTypeName.width
|
Layout.minimumWidth: presetName.width
|
||||||
Layout.maximumWidth: projectTypeName.width
|
Layout.maximumWidth: presetName.width
|
||||||
|
|
||||||
ToolTip {
|
ToolTip {
|
||||||
id: toolTip
|
id: toolTip
|
||||||
y: -toolTip.height
|
y: -toolTip.height
|
||||||
visible: delegate.hovered && projectTypeName.truncated
|
visible: delegate.hovered && presetName.truncated
|
||||||
text: name
|
text: name
|
||||||
delay: 1000
|
delay: 1000
|
||||||
height: 20
|
height: 20
|
||||||
@@ -176,7 +176,7 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: projectTypeResolution
|
id: presetResolution
|
||||||
color: DialogValues.textColor
|
color: DialogValues.textColor
|
||||||
text: resolution
|
text: resolution
|
||||||
font.pixelSize: DialogValues.defaultPixelSize
|
font.pixelSize: DialogValues.defaultPixelSize
|
||||||
@@ -219,7 +219,7 @@ ScrollView {
|
|||||||
: Qt.ArrowCursor
|
: Qt.ArrowCursor
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
removePresetDialog.presetName = projectTypeName.text
|
removePresetDialog.presetName = presetName.text
|
||||||
removePresetDialog.open()
|
removePresetDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,15 +232,15 @@ ScrollView {
|
|||||||
when: delegate.GridView.isCurrentItem
|
when: delegate.GridView.isCurrentItem
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: projectTypeName
|
target: presetName
|
||||||
color: DialogValues.textColorInteraction
|
color: DialogValues.textColorInteraction
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: projectTypeResolution
|
target: presetResolution
|
||||||
color: DialogValues.textColorInteraction
|
color: DialogValues.textColorInteraction
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: projectTypeIcon
|
target: presetIcon
|
||||||
color: DialogValues.textColorInteraction
|
color: DialogValues.textColorInteraction
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
|
Reference in New Issue
Block a user