summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-07-22 16:27:45 +0200
committerMitch Curtis <mitch.curtis@theqtcompany.com>2015-08-07 08:20:24 +0000
commitbe50531985f64089c87289ba0c026007437517a2 (patch)
treed9c974dff72a64031cfff60051e6b374e878ac42
parent966a053e7689f41807d8994a93d5fd3952e09932 (diff)
downloadqtquickcontrols-be50531985f64089c87289ba0c026007437517a2.tar.gz
Tree- & TableView: Fix non-left aligned text margins
This happens for both the item and header delegates. Previously, we were only taking left alignment into account. This resulted in poorly aligned item delegates with relation to the column header. Change-Id: I879d05cfb53641f02d5133a59fbe5a377b813f39 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
-rw-r--r--src/controls/Styles/Base/BasicTableViewStyle.qml8
-rw-r--r--src/controls/Styles/Desktop/TableViewStyle.qml5
2 files changed, 9 insertions, 4 deletions
diff --git a/src/controls/Styles/Base/BasicTableViewStyle.qml b/src/controls/Styles/Base/BasicTableViewStyle.qml
index 973d09c0..c8d817c9 100644
--- a/src/controls/Styles/Base/BasicTableViewStyle.qml
+++ b/src/controls/Styles/Base/BasicTableViewStyle.qml
@@ -94,7 +94,8 @@ ScrollViewStyle {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: styleData.textAlignment
- anchors.leftMargin: 12
+ anchors.leftMargin: horizontalAlignment === Text.AlignLeft ? 12 : 1
+ anchors.rightMargin: horizontalAlignment === Text.AlignRight ? 8 : 1
text: styleData.value
elide: Text.ElideRight
color: textColor
@@ -137,8 +138,9 @@ ScrollViewStyle {
Text {
id: label
objectName: "label"
- width: parent.width - x
- x: styleData.depth && styleData.column === 0 ? 0 : 8
+ width: parent.width - x - (horizontalAlignment === Text.AlignRight ? 8 : 1)
+ x: (styleData.hasOwnProperty("depth") && styleData.column === 0) ? 0 :
+ horizontalAlignment === Text.AlignRight ? 1 : 8
horizontalAlignment: styleData.textAlignment
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 1
diff --git a/src/controls/Styles/Desktop/TableViewStyle.qml b/src/controls/Styles/Desktop/TableViewStyle.qml
index 88f41d7f..1ead1b34 100644
--- a/src/controls/Styles/Desktop/TableViewStyle.qml
+++ b/src/controls/Styles/Desktop/TableViewStyle.qml
@@ -96,7 +96,10 @@ ScrollViewStyle {
font: __styleitem.font
anchors.left: parent.left
anchors.right: parent.right
- anchors.leftMargin: styleData.hasOwnProperty("depth") && styleData.column === 0 ? 0 : 8
+ anchors.leftMargin: styleData.hasOwnProperty("depth") && styleData.column === 0 ? 0 :
+ horizontalAlignment === Text.AlignRight ? 1 : 8
+ anchors.rightMargin: (styleData.hasOwnProperty("depth") && styleData.column === 0)
+ || horizontalAlignment !== Text.AlignRight ? 1 : 8
horizontalAlignment: styleData.textAlignment
anchors.verticalCenter: parent.verticalCenter
elide: styleData.elideMode