How to dynamicly change rows height in QTableView in QML
Unsolved
General and Desktop
-
Hi, I have a table of 4 columns, in one of which is text. When you change the width of the column, the width of the internal text also changes. In some cases, the width of the text becomes rather small and the text begins to increase its height (text wrap). How can I increase the height of the row in which this text is located?
This is a column with text
TableViewColumn { id: fullNameColumn property int minColWidth: 175 property int maxColWidth: 500 role: "fullName" title: "ФИО" width: 360 property string imageSource : "" onWidthChanged: { if (width < minColWidth) width = minColWidth } delegate: Rectangle{ id: rowCellContentFullName color: "transparent" Text { property int maxColWidth: 400 id: labelFullName objectName: "labelFullName" font.pixelSize: 13 wrapMode: Text.Wrap anchors.leftMargin: 38 anchors.left: parent.left horizontalAlignment: styleData.textAlignment anchors.verticalCenter: parent.verticalCenter visible: parent.visible width: parent.width - this.anchors.leftMargin * 2 text: styleData.value !== undefined ? styleData.value : "" color: "#474747" renderType: Text.NativeRendering } }
This is the rowDelegate
property Component rowDelegate: Rectangle { id: rowDel objectName: "RowDelegate" height: parent.parent.children[1].children[2].children[0].children[0].height < 50 ? 50 : parent.parent.children[1].children[2].children[0].children[0].height property color selectedColor: styleData.hasActiveFocus ? primaryColor : secondaryColor property bool selectionMaskVisible property bool selected: false }
In rowDelegate Im binding height with terrible expression, but it works. Works only for column 3 (where FullName). If i drag this column in another space my code doesnt work.
Can i change rows height in QTableView QML without this terrible expressions? Mb You know some way to solve this problem?