Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Getting the dimensions of a QTableWidget object
Forum Updated to NodeBB v4.3 + New Features

Getting the dimensions of a QTableWidget object

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 379 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Swati777999S Offline
    Swati777999S Offline
    Swati777999
    wrote on last edited by
    #1

    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! :)

    “ In order to be irreplaceable, one must always be different” – Coco Chanel

    jsulmJ 1 Reply Last reply
    0
    • Swati777999S Swati777999

      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! :)

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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 ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • Ketan__Patel__0011K Offline
        Ketan__Patel__0011K Offline
        Ketan__Patel__0011
        wrote on last edited by
        #3

        You can try this

        ui->YourTableWidget->geometry();

        it's Return Your TableWidget Location And Size;

        1 Reply Last reply
        0
        • JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved