Why doesn't ColumnView's PreviewWidget fill its container?
Unsolved
General and Desktop
-
I want the preview widget to automatically fill all the space in the column. I've tried setting layouts on everything. I've tried setting size policy. I can explicitly set the height of the QWidget, but it still doesn't adjust with the size of the window. Here's my code. Please help. Thanks.
#include <QApplication> #include <QColumnView> #include <QMainWindow> #include <QStandardItemModel> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow mainwindow; QColumnView columns; mainwindow.setCentralWidget(&columns); mainwindow.setGeometry(100,100,800,800); QStandardItemModel model; QStandardItem item("Item"); model.appendRow(&item); columns.setModel(&model); QWidget previewpane; previewpane.setStyleSheet("background-color: red;"); columns.setPreviewWidget(&previewpane); mainwindow.show(); return a.exec(); }
-
Hi and welcome to devnet,
Which version of Qt are you using ?
On which platform ?
How did you install it ? -
Qt 5.15.3 on Linux through Qt Creator.
-
Which distribution ?
Which desktop environment ? -
Arch. Openbox.