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. Qt5 qtablewidget size
Forum Updated to NodeBB v4.3 + New Features

Qt5 qtablewidget size

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 4 Posters 580 Views 3 Watching
  • 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.
  • I Offline
    I Offline
    iceruam
    wrote on 2 Aug 2019, 21:45 last edited by
    #1

    Can a qtablewidget size with a window when the user resizes the window?
    Every time I resize the window the table remains the same size, I would like the columns to expand, even if it is the last one.
    I have this included already:
    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
    ui->tableWidget->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Stretch);
    ui->tableWidget->resizeColumnsToContents();

    I had it in a horizontal layout, vertical layout, with spacer without spacer
    I can set the minimum size, that works.
    ![https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/a8674eef-1690-4217-bb6e-b23463c8d4bf/ddd53e1-fa3dc601-9c3e-4aba-a3ae-377b2cb9c215.jpg/v1/fill/w_1024,h_637,q_75,strp/table2_by_kradoow_ddd53e1-fullview.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9NjM3IiwicGF0aCI6IlwvZlwvYTg2NzRlZWYtMTY5MC00MjE3LWJiNmUtYjIzNDYzYzhkNGJmXC9kZGQ1M2UxLWZhM2RjNjAxLTljM2UtNGFiYS1hM2FlLTM3N2IyY2I5YzIxNS5qcGciLCJ3aWR0aCI6Ijw9MTAyNCJ9XV0sImF1ZCI6WyJ1cm46c2VydmljZTppbWFnZS5vcGVyYXRpb25zIl19.43ZDT7rOxl2Gr3Ty1GD3nSbjdfBfeOCNDd4dySsyN8U](image url)

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Aug 2019, 22:25 last edited by
      #2

      Hi,

      Are you sure that the layout is properly applied on the containing widget ?
      Are you sure that you put your QTableWidget inside that layout ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • I Offline
        I Offline
        iceruam
        wrote on 5 Aug 2019, 14:55 last edited by
        #3

        No, that is what I am trying to figure out I must be doing something wrong if it does (suppose to, able to) size with the window.
        I was not sure if it was possible to achieve what I want.

        P 1 Reply Last reply 5 Aug 2019, 21:15
        0
        • I iceruam
          5 Aug 2019, 14:55

          No, that is what I am trying to figure out I must be doing something wrong if it does (suppose to, able to) size with the window.
          I was not sure if it was possible to achieve what I want.

          P Offline
          P Offline
          Pl45m4
          wrote on 5 Aug 2019, 21:15 last edited by Pl45m4 8 May 2019, 21:22
          #4

          @iceruam

          It seems, that your centralWidget has no layout.

          In fact you created your tableView with Designer, check if there is a symbol with an X next to your centralWidget (on the right side of QtDesigner). It indicates that the specific container currently has no layout.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          M 1 Reply Last reply 6 Aug 2019, 11:52
          1
          • P Pl45m4
            5 Aug 2019, 21:15

            @iceruam

            It seems, that your centralWidget has no layout.

            In fact you created your tableView with Designer, check if there is a symbol with an X next to your centralWidget (on the right side of QtDesigner). It indicates that the specific container currently has no layout.

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 6 Aug 2019, 11:52 last edited by
            #5

            Hi
            Just to be 100% clear. where @Pl45m4 wants you to check.

            alt text

            P 1 Reply Last reply 6 Aug 2019, 11:56
            2
            • M mrjj
              6 Aug 2019, 11:52

              Hi
              Just to be 100% clear. where @Pl45m4 wants you to check.

              alt text

              P Offline
              P Offline
              Pl45m4
              wrote on 6 Aug 2019, 11:56 last edited by
              #6

              @mrjj

              Ok, actually it is not an "X", but a crossed-sign symbol :)


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              M 1 Reply Last reply 6 Aug 2019, 11:58
              0
              • P Pl45m4
                6 Aug 2019, 11:56

                @mrjj

                Ok, actually it is not an "X", but a crossed-sign symbol :)

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 6 Aug 2019, 11:58 last edited by mrjj 8 Jun 2019, 11:59
                #7

                @pl45m4
                Yeah, but funny enough, i also thought of it as small red X :)

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  iceruam
                  wrote on 6 Aug 2019, 21:05 last edited by
                  #8

                  I see the symbol , thanks.
                  Ah, I see what what I did, I was putting a layout in the form but not assigning a layout to the form.
                  Thanks!!!
                  I am just learning Qt.
                  Thanks for all the help and support and being so fast!

                  1 Reply Last reply
                  0

                  2/8

                  2 Aug 2019, 22:25

                  topic:navigator.unread, 6
                  • Login

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