summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2014-02-25 18:21:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-25 18:33:22 +0100
commit44e9533361045f299f43aa21bac55eaed87316f7 (patch)
tree757a808cf583b4197ed9dc2948003b3220a04373 /src
parent5c8e205c5f4f4a0d131cb1f2511ca0b91923c0f2 (diff)
downloadqtquickcontrols-44e9533361045f299f43aa21bac55eaed87316f7.tar.gz
Support text alignment for TableViewHeaderv5.3.0-alpha1
task-number: QTBUG-33072 [ChangeLog][QtQuickControls][TableView] TableView headers now respect TableViewColumn::textAlignment Change-Id: I482e74e10b8879b367bce8165fa9310b28a06ad2 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/Private/qquickstyleitem.cpp1
-rw-r--r--src/controls/Styles/Base/TableViewStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/TableViewStyle.qml2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index 958adbdd..21de9819 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -345,6 +345,7 @@ void QQuickStyleItem::initStyleOption()
QStyleOptionHeader *opt = qstyleoption_cast<QStyleOptionHeader*>(m_styleoption);
opt->text = text();
+ opt->textAlignment = static_cast<Qt::AlignmentFlag>(m_properties.value("textalignment").toInt());
opt->sortIndicator = activeControl() == "down" ?
QStyleOptionHeader::SortDown
: activeControl() == "up" ?
diff --git a/src/controls/Styles/Base/TableViewStyle.qml b/src/controls/Styles/Base/TableViewStyle.qml
index 512b0cfe..0c01cfee 100644
--- a/src/controls/Styles/Base/TableViewStyle.qml
+++ b/src/controls/Styles/Base/TableViewStyle.qml
@@ -87,7 +87,7 @@ ScrollViewStyle {
id: textItem
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
+ horizontalAlignment: styleData.textAlignment
anchors.leftMargin: 12
text: styleData.value
elide: Text.ElideRight
diff --git a/src/controls/Styles/Desktop/TableViewStyle.qml b/src/controls/Styles/Desktop/TableViewStyle.qml
index 88611ab5..b9891b31 100644
--- a/src/controls/Styles/Desktop/TableViewStyle.qml
+++ b/src/controls/Styles/Desktop/TableViewStyle.qml
@@ -75,7 +75,7 @@ ScrollViewStyle {
text: styleData.value
hover: styleData.containsMouse
hints: control.styleHints
- properties: {"headerpos": headerPosition}
+ properties: {"headerpos": headerPosition, "textalignment": styleData.textAlignment}
property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : "";
property string headerPosition: control.columnCount === 1 ? "only" :
styleData.column === control.columnCount-1 ? "end" :