Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.1.0
-
44e9533361045f299f43aa21bac55eaed87316f7
Description
The headers in TableView controls does not honor the horizontalAlignment option.
TableView { anchors.fill: parent TableViewColumn{ role: "title"; title: "Title"; horizontalAlignment: Text.AlignHCenter; width: 320 } TableViewColumn{ role: "author"; title: "Author"; horizontalAlignment: Text.AlignHCenter; width: 320 } model: libraryModel }
There is a workaround at the moment by modifying the headerDelegate component.
TableView { anchors.fill: parent TableViewColumn{ role: "title"; title: "Title"; horizontalAlignment: Text.AlignHCenter; width: 320 } TableViewColumn{ role: "author"; title: "Author"; horizontalAlignment: Text.AlignHCenter; width: 320 } model: libraryModel headerDelegate: Item { height: 20 clip: true Rectangle { anchors.fill: parent anchors.leftMargin: -1 anchors.topMargin: -1 gradient: Gradient { GradientStop { color: "#eee" ; position: 0 } GradientStop { color: "#ccc" ; position: 1 } } border.color: "#aaa" } Text { anchors.fill: parent horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter text: styleData.value elide: Text.ElideMiddle renderType: Text.NativeRendering } } }