Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Center table in widget/window
Gianluca86 last edited by Gianluca86
I want to be able to put at the center of a widget (or window) a table, more precisely a QTableWidget.
I tried using the following command.
QTableWidget Table = new QTableWidget(20,2,this); Table->setEditTriggers(QAbstractItemView::NoEditTriggers); Table->setSelectionMode(QAbstractItemView::SingleSelection); Table->setFrameStyle(QFrame::NoFrame); Table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); Table->verticalHeader()->setVisible(FALSE); verticalLayout->addWidget(Table); verticalLayout->setAlignment(Table,Qt::AlignHCenter);
The table actually is positioned in the center, but it is cut in the right side, the scrollbar appears, but I want to see the entire table without scroolbar.
If you don't want any scrollbars then you have to ensure that the widget is big enough to show everything.