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 Design - Change between many buttons / one button with menu depending on space available
Forum Updated to NodeBB v4.3 + New Features

Responsive Design - Change between many buttons / one button with menu depending on space available

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 444 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.
  • gde23G Offline
    gde23G Offline
    gde23
    wrote on last edited by
    #1

    Hi,

    I have a UI where there are many QToolButtons in a HBoxLayout.
    Now if the monitor size is too small I want to group them in fewer QToolButtons that have a menu instead of individual buttons.

    Is there some default mechanism in Qt implemented for this kind of task or do I have to implement it myself?
    And if not, is there an example on how to implement this somewhere?

    Since it is a common problem I guess somebody has solved it before.

    Thanks

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      well qtoolbar shows maker and can expand the toolbar.
      alt text
      It will not make a menu out of it. That is something you have to implement yourself. :)
      And a layout will not by any means do such thing.

      1 Reply Last reply
      2
      • gde23G Offline
        gde23G Offline
        gde23
        wrote on last edited by
        #3

        @mjii thanks for the hint with the toolbar. However I prefer the menu and therefore will implement it myself.
        There I have one question:
        How is it possible to find out if there is enough space for a widget or if it gets vignetted/cut off?

        mrjjM 1 Reply Last reply
        0
        • gde23G gde23

          @mjii thanks for the hint with the toolbar. However I prefer the menu and therefore will implement it myself.
          There I have one question:
          How is it possible to find out if there is enough space for a widget or if it gets vignetted/cut off?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          hi

          -How is it possible to find out if there is enough space for a widget or if it gets vignetted/cut off?

          Well you can use
          http://doc.qt.io/qt-5/qrect.html#contains-1
          with proper as true.
          for the widget and its parents's rect()
          (i assume parent adjusts to windows size)

          1 Reply Last reply
          1

          • Login

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