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. Layout -> Signal when resized
Forum Updated to NodeBB v4.3 + New Features

Layout -> Signal when resized

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 4.8k 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.
  • F Offline
    F Offline
    Flaming Moe
    wrote on 23 Jan 2020, 19:10 last edited by Flaming Moe
    #1

    Hi there,

    short version:
    Is there a way to get notified when a layout is resized (like a SIGNAL() I could QObject::connect to)? For example when the user resizes the main window with mouse on a desktop, or when a mobie is turned?

    Long version:
    I want to have an "area" where I can display items one below the other and scroll trough them. This area has a vertical orientation and is part of a grid layout. When I add items to this "area" I want them to be square-shaped with the width and height equal to the width of the "area".
    I used to solve that by using a scroll area, attach widgets to it´s mainwidget with incrementals of vertical displacement, resize the mainwidget and update the scrollarea.
    May be, there is a smarter way?
    At least, if I coud get a notification about the main window beeing resized, I could resize the mainwidget of the scrollarea and it´s sibblings manually.

    best regards,
    Moe

    A lovely day for a ̶g̶̶u̶̶i̶̶n̶̶n̶̶e̶̶s̶ DUFF^^

    J 1 Reply Last reply 23 Jan 2020, 19:16
    0
    • F Flaming Moe
      23 Jan 2020, 19:10

      Hi there,

      short version:
      Is there a way to get notified when a layout is resized (like a SIGNAL() I could QObject::connect to)? For example when the user resizes the main window with mouse on a desktop, or when a mobie is turned?

      Long version:
      I want to have an "area" where I can display items one below the other and scroll trough them. This area has a vertical orientation and is part of a grid layout. When I add items to this "area" I want them to be square-shaped with the width and height equal to the width of the "area".
      I used to solve that by using a scroll area, attach widgets to it´s mainwidget with incrementals of vertical displacement, resize the mainwidget and update the scrollarea.
      May be, there is a smarter way?
      At least, if I coud get a notification about the main window beeing resized, I could resize the mainwidget of the scrollarea and it´s sibblings manually.

      best regards,
      Moe

      J Offline
      J Offline
      JonB
      wrote on 23 Jan 2020, 19:16 last edited by JonB
      #2

      @Flaming-Moe said in Layout -> Signal when resized:

      At least, if I coud get a notification about the main window beeing resized, I could resize the mainwidget of the scrollarea and it´s sibblings manually.

      Are you aware that every widget inherits https://doc.qt.io/qt-5/qwidget.html#resizeEvent ? Or there is https://doc.qt.io/qt-5/qobject.html#installEventFilter if you don't want to subclass.

      1 Reply Last reply
      3
      • F Offline
        F Offline
        Flaming Moe
        wrote on 24 Jan 2020, 10:37 last edited by
        #3

        Thanks for the hint - I used the EventFilter. Changed the example to always forward the event and in case the event is of type Resize, it emits a Signal, which is can be connected to a slot.

        Think, that will do the job :>

        A lovely day for a ̶g̶̶u̶̶i̶̶n̶̶n̶̶e̶̶s̶ DUFF^^

        1 Reply Last reply
        1

        1/3

        23 Jan 2020, 19:10

        • Login

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