Getting the dimensions of a QTableWidget object
-
Hi All,
In the main window, my outer widget is QLayout inside which a QTableWidget resides.
Now, I want to get the dimensions of the inner widget which is of QTableWidget type, so that I can resize the outer widget which is of QLayout type.
Suppose my inner widget is
QTableWidget *first_table=new QTableWidget();
whereas my outer widget is
QGridLayout *tableLayout = new QGridLayout();By first_table->width();, I can get the width of the inner widget but how to get its dimension.
Any suggestion will be appreciated.
Thanks! :)
-
Hi All,
In the main window, my outer widget is QLayout inside which a QTableWidget resides.
Now, I want to get the dimensions of the inner widget which is of QTableWidget type, so that I can resize the outer widget which is of QLayout type.
Suppose my inner widget is
QTableWidget *first_table=new QTableWidget();
whereas my outer widget is
QGridLayout *tableLayout = new QGridLayout();By first_table->width();, I can get the width of the inner widget but how to get its dimension.
Any suggestion will be appreciated.
Thanks! :)
@Swati777999 said in Getting the dimensions of a QTableWidget object:
whereas my outer widget is
QGridLayout *tableLayout = new QGridLayout();It's not a widget but a layout.
What's wrong with https://doc.qt.io/qt-5/qlayout.html#geometry ?
-
You can try this
ui->YourTableWidget->geometry();it's Return Your TableWidget Location And Size;
-
Since the user is asking the same question and getting the same answers in thread https://forum.qt.io/topic/132497/how-to-get-the-dimensions-of-the-widgets, suggest people don't post further in this thread.