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. Minimum height of QTableView

Minimum height of QTableView

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.5k Views 2 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    I have a table view in a dockable window. The geometry is shown in Qt Designer with a width of 600 and height of 190 and I cannot work out how to change it ( want to reduce the minimum height to about (say) 60 px).

    Am I missing something very obvious? I tried changing the minimum height to 60 px but that didn't help.

    Thanks
    David

    JoeCFDJ 1 Reply Last reply
    0
    • PerdrixP Perdrix

      @Axel-Spoerl Thanks, Axel. Currently it is set Expanding,Expanding

      What should I set to allow it to be resizeable to the minimum size I set (currently set to 600x60).

      I tried setting a size policy of (Expanding, MinimumExpanding) but that didn't change the geometry at all, I also couldn't resize the widget smaller in Designer.

      D.

      PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #7

      @Perdrix Problem solved - there was a minimum size on the QDockWidget that was set. I adjusted that and all appears good now!

      Thanks, D

      1 Reply Last reply
      1
      • PerdrixP Perdrix

        I have a table view in a dockable window. The geometry is shown in Qt Designer with a width of 600 and height of 190 and I cannot work out how to change it ( want to reduce the minimum height to about (say) 60 px).

        Am I missing something very obvious? I tried changing the minimum height to 60 px but that didn't help.

        Thanks
        David

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #2

        @Perdrix Check its ui_something(class name) file and show its settings here.

        PerdrixP 1 Reply Last reply
        0
        • JoeCFDJ JoeCFD

          @Perdrix Check its ui_something(class name) file and show its settings here.

          PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote on last edited by
          #3

          @JoeCFD

                  tableView = new QTableView(dockWidgetContents);
                  tableView->setObjectName("tableView");
                  tableView->setMinimumSize(QSize(600, 175));
                  tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
                  tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
                  tableView->setSortingEnabled(true);
                  tableView->verticalHeader()->setVisible(false);
          

          The ui file said the same for minimum size.

          I edited the ui file to change the minimum height to 60, and rebuilt. the header file now says:

              tableView->setMinimumSize(QSize(600, 60)); 
          

          but I still cannot resize the table view that small!!!

          If I open the ui file in Designer the geometry still reports 600*192

          David

          JoeCFDJ Axel SpoerlA 2 Replies Last reply
          0
          • PerdrixP Perdrix

            @JoeCFD

                    tableView = new QTableView(dockWidgetContents);
                    tableView->setObjectName("tableView");
                    tableView->setMinimumSize(QSize(600, 175));
                    tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
                    tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
                    tableView->setSortingEnabled(true);
                    tableView->verticalHeader()->setVisible(false);
            

            The ui file said the same for minimum size.

            I edited the ui file to change the minimum height to 60, and rebuilt. the header file now says:

                tableView->setMinimumSize(QSize(600, 60)); 
            

            but I still cannot resize the table view that small!!!

            If I open the ui file in Designer the geometry still reports 600*192

            David

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #4

            @Perdrix ui_something file is dynamically generated from the ui xml file created in designer. Nothing will change if you change anything inside ui_something file. But you can see what is wrong there.

            if tableView->setMinimumSize(QSize(600, 175)); is defined in ui_something file, that means its minimum height is 175, not 60 as you expect.
            In Designer, you might not set minimum size properly. Open the xml ui file in an editor and check the minimum size of this tableView.

            1 Reply Last reply
            1
            • PerdrixP Perdrix

              @JoeCFD

                      tableView = new QTableView(dockWidgetContents);
                      tableView->setObjectName("tableView");
                      tableView->setMinimumSize(QSize(600, 175));
                      tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
                      tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
                      tableView->setSortingEnabled(true);
                      tableView->verticalHeader()->setVisible(false);
              

              The ui file said the same for minimum size.

              I edited the ui file to change the minimum height to 60, and rebuilt. the header file now says:

                  tableView->setMinimumSize(QSize(600, 60)); 
              

              but I still cannot resize the table view that small!!!

              If I open the ui file in Designer the geometry still reports 600*192

              David

              Axel SpoerlA Offline
              Axel SpoerlA Offline
              Axel Spoerl
              Moderators
              wrote on last edited by
              #5

              @Perdrix
              Hi David,
              I think the table view's QWidget::sizePolicy()can help to achieve the required behavior.
              You can set it programmatically or in designer.
              Cheers
              Axel

              Software Engineer
              The Qt Company, Oslo

              PerdrixP 1 Reply Last reply
              0
              • Axel SpoerlA Axel Spoerl

                @Perdrix
                Hi David,
                I think the table view's QWidget::sizePolicy()can help to achieve the required behavior.
                You can set it programmatically or in designer.
                Cheers
                Axel

                PerdrixP Offline
                PerdrixP Offline
                Perdrix
                wrote on last edited by Perdrix
                #6

                @Axel-Spoerl Thanks, Axel. Currently it is set Expanding,Expanding

                What should I set to allow it to be resizeable to the minimum size I set (currently set to 600x60).

                I tried setting a size policy of (Expanding, MinimumExpanding) but that didn't change the geometry at all, I also couldn't resize the widget smaller in Designer.

                D.

                PerdrixP 1 Reply Last reply
                0
                • PerdrixP Perdrix

                  @Axel-Spoerl Thanks, Axel. Currently it is set Expanding,Expanding

                  What should I set to allow it to be resizeable to the minimum size I set (currently set to 600x60).

                  I tried setting a size policy of (Expanding, MinimumExpanding) but that didn't change the geometry at all, I also couldn't resize the widget smaller in Designer.

                  D.

                  PerdrixP Offline
                  PerdrixP Offline
                  Perdrix
                  wrote on last edited by
                  #7

                  @Perdrix Problem solved - there was a minimum size on the QDockWidget that was set. I adjusted that and all appears good now!

                  Thanks, D

                  1 Reply Last reply
                  1
                  • PerdrixP Perdrix has marked this topic as solved on

                  • Login

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