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. QTableview not fitting the entire dockwidget window
QtWS25 Last Chance

QTableview not fitting the entire dockwidget window

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 3 Posters 9.0k 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 14 Apr 2016, 11:41 last edited by
    #18

    If you get what's on image1 it means that you didn't apply the QVBoxLayout properly. With it these buttons can't be side by side unless:

    1. They are in a QHBoxLayout
    2. Not in a layout at all but you put them side by side on the widget in designer.

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

    S 1 Reply Last reply 14 Apr 2016, 11:48
    0
    • S SGaist
      14 Apr 2016, 11:41

      If you get what's on image1 it means that you didn't apply the QVBoxLayout properly. With it these buttons can't be side by side unless:

      1. They are in a QHBoxLayout
      2. Not in a layout at all but you put them side by side on the widget in designer.
      S Offline
      S Offline
      saitej
      wrote on 14 Apr 2016, 11:48 last edited by
      #19

      @SGaist
      The buttons are not the problem I want the tableview to occupy the entire dock but it is coming in a fixed size how much ever i increase the dock size.
      Image

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 14 Apr 2016, 11:50 last edited by
        #20

        hi
        Here is a sample that uses a UI and scale with the dock
        https://www.dropbox.com/s/6ipc9ap6hjvcpr9/ilovemydocks.zip?dl=0
        Maybe it can provide some hint.
        Note the UI is widget based for this to work.

        S 1 Reply Last reply 14 Apr 2016, 12:20
        0
        • M mrjj
          14 Apr 2016, 11:50

          hi
          Here is a sample that uses a UI and scale with the dock
          https://www.dropbox.com/s/6ipc9ap6hjvcpr9/ilovemydocks.zip?dl=0
          Maybe it can provide some hint.
          Note the UI is widget based for this to work.

          S Offline
          S Offline
          saitej
          wrote on 14 Apr 2016, 12:20 last edited by
          #21

          @mrjj
          I have changed the list widget to tablewidget and added the header columns.
          You can observe that the table fits the entire dock. I have done same thing in my other code also but the table does not fit the entire dock (i have used tableview but i guess it should not matter).
          Note: the dock code is same.

          https://www.dropbox.com/s/c04cuu1yoykbtc6/ilovemydocks.zip?dl=0

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 14 Apr 2016, 12:28 last edited by
            #22

            hi
            A note
            if u set setFixedSize, it wont be resizeable ?

            Well the layout are in the UI file. Inserted as the first thing.

            It sounds to me that your OTHER code is not using the layout
            correctly?

            The scaling is done via layout and layout is the first thing to insert into
            the UI. then the rest of the controls. Matters not which Widgets. All can
            be managed by a layout.

            S 1 Reply Last reply 15 Apr 2016, 05:01
            0
            • M mrjj
              14 Apr 2016, 12:28

              hi
              A note
              if u set setFixedSize, it wont be resizeable ?

              Well the layout are in the UI file. Inserted as the first thing.

              It sounds to me that your OTHER code is not using the layout
              correctly?

              The scaling is done via layout and layout is the first thing to insert into
              the UI. then the rest of the controls. Matters not which Widgets. All can
              be managed by a layout.

              S Offline
              S Offline
              saitej
              wrote on 15 Apr 2016, 05:01 last edited by
              #23

              @mrjj
              I dont want the dock to be resizeable but the tableview to fit the dock entirely. I have commented out all the layout code and put vertical layout in the designer. Still, I get the same problem.

              M 1 Reply Last reply 15 Apr 2016, 06:35
              0
              • S saitej
                15 Apr 2016, 05:01

                @mrjj
                I dont want the dock to be resizeable but the tableview to fit the dock entirely. I have commented out all the layout code and put vertical layout in the designer. Still, I get the same problem.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 15 Apr 2016, 06:35 last edited by
                #24

                @saitej
                well if the layout is applied correctly, you can see at once in Designer that
                it works so there must be something wrong.

                To put the vertical layout, you
                right click and go to the layout menu ?

                S 1 Reply Last reply 15 Apr 2016, 07:04
                0
                • M mrjj
                  15 Apr 2016, 06:35

                  @saitej
                  well if the layout is applied correctly, you can see at once in Designer that
                  it works so there must be something wrong.

                  To put the vertical layout, you
                  right click and go to the layout menu ?

                  S Offline
                  S Offline
                  saitej
                  wrote on 15 Apr 2016, 07:04 last edited by
                  #25

                  @mrjj

                  I am attaching the images of the layout and the output.

                  layout UI
                  output

                  M 1 Reply Last reply 15 Apr 2016, 07:25
                  0
                  • S saitej
                    15 Apr 2016, 07:04

                    @mrjj

                    I am attaching the images of the layout and the output.

                    layout UI
                    output

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 15 Apr 2016, 07:25 last edited by mrjj
                    #26

                    @saitej said:
                    super
                    I can see the error.
                    You have dragged a layout from left side.
                    Those are for floating layouts or layout in layout.

                    To apply layout, simply right click the form,
                    and use the Layout menu. That will scale.
                    Do not drag from the left. Right click. :)

                    You dont have to remove the red layout. Simply right click outside and apply
                    layout via the layout menu to the form object.

                    http://doc.qt.io/qt-5/designer-layouts.html

                    S 1 Reply Last reply 15 Apr 2016, 07:39
                    0
                    • M mrjj
                      15 Apr 2016, 07:25

                      @saitej said:
                      super
                      I can see the error.
                      You have dragged a layout from left side.
                      Those are for floating layouts or layout in layout.

                      To apply layout, simply right click the form,
                      and use the Layout menu. That will scale.
                      Do not drag from the left. Right click. :)

                      You dont have to remove the red layout. Simply right click outside and apply
                      layout via the layout menu to the form object.

                      http://doc.qt.io/qt-5/designer-layouts.html

                      S Offline
                      S Offline
                      saitej
                      wrote on 15 Apr 2016, 07:39 last edited by
                      #27

                      @mrjj
                      Thanks a lot!!

                      I should have sent the UI image earlier. Sorry for the inconvenience.

                      M 1 Reply Last reply 15 Apr 2016, 07:44
                      1
                      • S saitej
                        15 Apr 2016, 07:39

                        @mrjj
                        Thanks a lot!!

                        I should have sent the UI image earlier. Sorry for the inconvenience.

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 15 Apr 2016, 07:44 last edited by
                        #28

                        @saitej
                        Np. The drag able layout are a bit non intuitive :)
                        Note:
                        If you have a completely new form with no widgets, you must
                        place 1 widget on form for the right click menu to be active . that
                        fooled me a lot in the beginning. :)

                        1 Reply Last reply
                        0

                        27/28

                        15 Apr 2016, 07:39

                        • Login

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