[QML] How can I change the font size and Co in a TableView?
Unsolved
QML and Qt Quick
-
Hey~
I am trying to change the font size of the values in the TableView.
But it doesn't work...This is my code which I am using:
import QtQuick 2.0 import QtQuick.Controls 1.4 import QtQuick.Window 2.1 Window { id: participantWindow width: 840 height: 500 TableView { anchors.fill: racesWindow width: 840 height: 400 model: getData TableViewColumn { role: "name" title: "Name" width: 200 } } Button{ id: close width: 840 height: 80 anchors.horizontalCenter: racesWindow text: "Save" MouseArea{ onClicked: racesWindow.close() } } }
How can I fix that? Any ideas?
I would be so happy if anybody could help me~
Thank you so much!!!! -
Hi rylics,
You can use itemDelegate in TableView for specific cells or all cells.Window { id: participantWindow width: 840 height: 500 TableView { anchors.fill: racesWindow width: 840 height: 400 model: getData TableViewColumn { role: "name" title: "Name" width: 200 } itemDelegate: Item { Text { anchors.verticalCenter: parent.verticalCenter color: "green" elide: styleData.elideMode text: styleData.value font.pixelSize: 14 } } } Button{ id: close width: 840 height: 80 anchors.horizontalCenter: racesWindow text: "Save" MouseArea{ onClicked: racesWindow.close() } } }