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. QTabwidget - a problem with layouts
Forum Updated to NodeBB v4.3 + New Features

QTabwidget - a problem with layouts

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 558 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.
  • Q Offline
    Q Offline
    qAlexKo
    wrote on last edited by qAlexKo
    #1

    Hi, Qts!

    Please suggest a way out
    I have a task to make an app with two different graphs.

    I've created a QMainWindow app, put a Horizontal QHBoxLayout and inside it QTabWidget.
    I has made two pages, each of every future graph.
    I set up the tabwidget Layout property as vertical
    I put three QVBoxLayouts on the fist page and it looked good.

    But when I tried to make layouts on the second page I could not do it. It means I cannot do my second graph on the second tab.

    I also have found out that the pages of the QTabWidget have no Layout properties and therefore layouts on them don't stretch when the app changes its size.

    Can you suggest how I can do my task? Maybe I should you some other widgets? The same thing happens with QStackedWidget

    Just ib case I send my test screenshot.

    tab_layout.JPG

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher moved this topic from C++ Gurus on
    • Q qAlexKo

      Hi, Qts!

      Please suggest a way out
      I have a task to make an app with two different graphs.

      I've created a QMainWindow app, put a Horizontal QHBoxLayout and inside it QTabWidget.
      I has made two pages, each of every future graph.
      I set up the tabwidget Layout property as vertical
      I put three QVBoxLayouts on the fist page and it looked good.

      But when I tried to make layouts on the second page I could not do it. It means I cannot do my second graph on the second tab.

      I also have found out that the pages of the QTabWidget have no Layout properties and therefore layouts on them don't stretch when the app changes its size.

      Can you suggest how I can do my task? Maybe I should you some other widgets? The same thing happens with QStackedWidget

      Just ib case I send my test screenshot.

      tab_layout.JPG

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @qAlexKo
      Don't ask me how it works with layouts in Designer, it's a dark art! But try doing it this way:

      • Delete the layout you currently show on tab_2.
      • Drag any widget onto it, say a Push button. You need to do this.
      • Now right-click on the Tab 2 in the designer (middle pane).
      • Bottom of context menu, Lay out > sub-menu, pick Lay Out Horizontally/Vertically.
      • You may now delete the push button you created earlier if you wish. Without it there you would not be able to set the layout, but once you have done so the layout stays even if no widgets.

      You end up with the Object Explorer at right showing like:
      0097231f-9e71-403d-b889-aad67668b9de-image.png
      Note that my tab_2 does not have the "red no-entry sign" yours does. That indicates a missing layout, and things won't work while in that state.

      As I said, do not ask me about setting the layout this way versus you dragging a layout object onto it, because I don't know! I just know this way works. I don't think I have ever picked a layout object. I would go back and do your first tab the same way too.

      Q 1 Reply Last reply
      1
      • JonBJ JonB

        @qAlexKo
        Don't ask me how it works with layouts in Designer, it's a dark art! But try doing it this way:

        • Delete the layout you currently show on tab_2.
        • Drag any widget onto it, say a Push button. You need to do this.
        • Now right-click on the Tab 2 in the designer (middle pane).
        • Bottom of context menu, Lay out > sub-menu, pick Lay Out Horizontally/Vertically.
        • You may now delete the push button you created earlier if you wish. Without it there you would not be able to set the layout, but once you have done so the layout stays even if no widgets.

        You end up with the Object Explorer at right showing like:
        0097231f-9e71-403d-b889-aad67668b9de-image.png
        Note that my tab_2 does not have the "red no-entry sign" yours does. That indicates a missing layout, and things won't work while in that state.

        As I said, do not ask me about setting the layout this way versus you dragging a layout object onto it, because I don't know! I just know this way works. I don't think I have ever picked a layout object. I would go back and do your first tab the same way too.

        Q Offline
        Q Offline
        qAlexKo
        wrote on last edited by qAlexKo
        #3

        @JonB Thanks for explanation, I also have found something in the internet here:
        https://www.youtube.com/watch?v=8JYEdXDhrTY

        It is without voice, and you will need to grasp why it doesn't work ;-) -- because it does work and make the process very easy.

        Attention: when you follow the clip and put a new layer on the locked second tab you must(!) click then on the second tab page and only after that press the right button and call the Layer menu. In the menu you must choose "Lay out in a Grid". ;-))) It was fun, in short. ;)

        1 Reply Last reply
        0

        • Login

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