set cell width to content width in TableView
-
Hi, Here is the following code :
import QtQuick 2.14 import QtQuick.Controls 2.14 TableView { id: root property var base height: 50 * rows width: base.width clip: true columnSpacing: 1 rowSpacing: 1 delegate: Rectangle { implicitWidth: textinput.contentWidth + 10 implicitHeight: textinput.contentHeight + 10 TextInput { anchors.fill: parent id: textinput text: display onTextChanged: {forceLayout()} } } }I have the following warning :
TableView::forceLayout(): Cannot do an immediate re-layout during an ongoing layout!If I use
onTextEditedinstead ofonTextChangedno warning but after initial load, colomn width is not well adjusted. It's fixed after I edit one cell.