tuli
18th August 2014, 15:20
this code in the constructor of my QWidget inherited class:
QHBoxLayout* hv = new QHBoxLayout(this);
QTableWidget* tv = new QTableWidget(this);
tv->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tv->setSelectionBehavior(QAbstractItemView::SelectionB ehavior::SelectItems);
tv->setColumnCount(20);
tv->setRowCount(20);
hv->addWidget(tv);
setLayout(hv);
creates the tablewidget crammed in the upperleft corner like this:
https://i.imgur.com/ZWjY2mE.png
The tableview that stretches itself over the entire widget as it is supposed to has been created by QtCreator form designer. However, it uses the exact same code! I literally copied over the generated code into my class, but some how only the auto-generated widget stretches properly. Removing the generated one doesnt help either.
Now, why the hell doesnt it stretch correctly!? Seriously, this shit is driving my crazy.
QHBoxLayout* hv = new QHBoxLayout(this);
QTableWidget* tv = new QTableWidget(this);
tv->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tv->setSelectionBehavior(QAbstractItemView::SelectionB ehavior::SelectItems);
tv->setColumnCount(20);
tv->setRowCount(20);
hv->addWidget(tv);
setLayout(hv);
creates the tablewidget crammed in the upperleft corner like this:
https://i.imgur.com/ZWjY2mE.png
The tableview that stretches itself over the entire widget as it is supposed to has been created by QtCreator form designer. However, it uses the exact same code! I literally copied over the generated code into my class, but some how only the auto-generated widget stretches properly. Removing the generated one doesnt help either.
Now, why the hell doesnt it stretch correctly!? Seriously, this shit is driving my crazy.