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. Responsive QWidget: is it possible?
Forum Updated to NodeBB v4.3 + New Features

Responsive QWidget: is it possible?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.7k 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.
  • X Offline
    X Offline
    xtingray
    wrote on last edited by
    #1

    Hi,

    I am working on a desktop app composed for several panels. Every panel is a QWidget, but depending on different events, some of the widgets are removed from the interface creating empty spaces. I would like that the remaining widgets automatically expand their dimensions in a responsive way covering the available spaces of the main window.

    Is there a way to implement this requirement? Thanks.


    Qt Developer

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Yes: use layouts, like QHBoxLayout, QVBoxLayout, QGridLayout etc. Then all your widgets will automatically adjust their sizes (you can control it by setting size policy).

      I suspect what you describe is an issue that once a QWidget is removed from layout, the layout still keeps it's space (which is now empty). To work around that, use takeAt() when removing widgets.

      (Z(:^

      1 Reply Last reply
      4

      • Login

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