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 child widget to automatically resize itself to size of parent widget via Qt Creator?
Forum Updated to NodeBB v4.3 + New Features

Getting child widget to automatically resize itself to size of parent widget via Qt Creator?

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

    I have a QGroupBox that contains a QTabWidget. I want the QTabWidget to fill the entire QGroupBox, so whenever the size of the QGroupBox changes, the size of QTabWidget needs to change as well.

    I'm still very new to Qt, but I am pretty well versed with wxWidgets. Now, I'm sure there's probably some sort of "resize" signal that QGroupBox might emit, which I can then hook up to a slot which would then resize the QTabWidget. I don't know enough details about Qt yet to know for sure, but I would imagine it would be something like that. However, that's doing it through code.

    I get the feeling I should able to use Qt's layouts to do the resizing for me automagically. In wxWidgets, I would stick a wxSizer (wx's version of a QLayout) inside the group box object, then stick the tab widget inside the wxSizer, adjust the wxSizer's properties accordingly and then wxWidgets would handle all the resizing for me. I'm guessing Qt's QLayout should be able to do the same thing. Furthermore, I should be able to specify all of this via Qt Creator. However, I haven't been able to figure it out.

    Can somebody please help? Thanks!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Indeed you should use a layout.
      You can right-click inside the group box, and you'll find the different layout types you can use there.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        asincero
        wrote on last edited by
        #3

        That was it, sir. Thanks!

        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