anchor tableview under column
Solved
QML and Qt Quick
-
I have a Column and a TableView. I want the TableView to be under the Column so I tried this:
Window { id: root //... Column{ id: displayColumn //... } } TableView { anchors.top: displayColumn.bottom clip: true //.... } } }
But somehow it does not work. Whats the problem here?
-
@sandro4912
You have to provide column width and height or implement an item inside column with width and height.
I tested with code below:import QtQuick 2.14 import QtQuick.Window 2.14 import QtQuick.Controls 1.4 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Column { id: colum1 // width: 30 // height: 30 Rectangle { width: 30 height: 30 color: "red" } } ListModel { id: libraryModel ListElement { title: "A Masterpiece" author: "Gabriel" } ListElement { title: "Brilliance" author: "Jens" } ListElement { title: "Outstanding" author: "Frederik" } } TableView { anchors.top: colum1.bottom TableViewColumn { role: "title" title: "Title" width: 100 } TableViewColumn { role: "author" title: "Author" width: 200 } model: libraryModel } }
-
thanks for the effort of reproducing the issue. It solved now.