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. [solved] How to expand widget in other widget without using layout?

[solved] How to expand widget in other widget without using layout?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 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.
  • N Offline
    N Offline
    never_ever
    wrote on last edited by
    #1

    Hi,
    I have one widget (QWidget) that contains QScrollArea widget (I needed scroll bars for my program).
    I have problem with QScrollArea that doesn't fit to its parent (QWidget) - area should have the same size as QWidget. Probably I can do this by installing a resizing filter, but I was wondering if there is other way to do this?
    I can't use layout, because my QWidget could be resized to its minimum size (until I don't see any childs inside it, practically the height is near to 0). When I use layout I can't resize widget to minimum because scrollbars prevent from this - in that situation I can minimize QWidget only to size when scrollbar is minimum.
    I don't know if I explain it clearly, but if not please write I will try to do this better.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      did you notice "QScrollArea's 'widgetResizable' property":http://doc.qt.io/qt-5/qscrollarea.html#widgetResizable-prop ?
      If i understood you correct thats what you want... but probably i did not :)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

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

        just reimplement resizeEvent() in your containg QWidget, and get the geometry of your contained QScrollArea manually in that code.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          never_ever
          wrote on last edited by
          #4

          Raven-worx: setting widgetResizable to true allows to resize QScrollArea to it child widget (I assume that from docs). I want to resize that area to it's parent.

          Andre: Previously I was thinking about writing filter, but creating my own class that inherits QWidget was the best solution, 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