Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. how to add button list?
Forum Updated to NodeBB v4.3 + New Features

how to add button list?

Scheduled Pinned Locked Moved Unsolved Qt 6
4 Posts 3 Posters 691 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.
  • Y Offline
    Y Offline
    yangyanhui4
    wrote on 6 Apr 2022, 06:04 last edited by
    #1

    hi,I need to generate some QPushButtons in a HLayout line. When there are too many buttons generated,the buttons will be shown as follows:![alt text](QQ图片20220406135706.png image url).I have set the min width of each button to make the label of the button to show wholely.In such case, I want to generate a special button.the result is shown as followsQQ图片20220406140027.jpg . I guess I need to calculate the whole width of all buttons. If the width of the QWidget is not enough to contain all the buttons,then put the rest buttons into a list. How can I realize it in QT, the picture is a web.
    thanks

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on 6 Apr 2022, 14:16 last edited by
      #2

      It's not what you want, but the Flow Layout Example might be helpful for you to figure out how to create a custom layout class that does what you want.

      1 Reply Last reply
      1
      • Y Offline
        Y Offline
        yangyanhui4
        wrote on 7 Apr 2022, 01:35 last edited by
        #3

        I need to show all(or part) buttons in one line. If some buttons cannot show in the panel,then hide it and show it in a list,just as the result in the picture

        J 1 Reply Last reply 7 Apr 2022, 08:20
        0
        • Y yangyanhui4
          7 Apr 2022, 01:35

          I need to show all(or part) buttons in one line. If some buttons cannot show in the panel,then hide it and show it in a list,just as the result in the picture

          J Offline
          J Offline
          JonB
          wrote on 7 Apr 2022, 08:20 last edited by
          #4

          @yangyanhui4
          There is no "in-built" facility for that, you need to write it yourself. As @mchinand wrote the Flow Layout Example may give you a good starting point.

          1 Reply Last reply
          0

          1/4

          6 Apr 2022, 06:04

          • Login

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