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. Menubuttons with fixed width / max-width for varying titletext
Forum Updated to NodeBB v4.3 + New Features

Menubuttons with fixed width / max-width for varying titletext

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 892 Views 2 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.
  • F Offline
    F Offline
    Fuzzi
    wrote on last edited by
    #1

    Hi!

    The ebook management program calibre uses Qt to display its UI (calibre sourcecode).

    Calibre screenshot:
    0_1526921265253_Screenshot (140).png

    Is it possible to limit the top menubutton's size either to a fixed width or a max-width?
    Fixed width would look much cleaner and max-width is the standard for MS Windows ribbon design.

    The thing is that according to the translation the text changes and word-wrap at spaces (and slashes?) is needed.

    An example:
    0_1526921298883_calibre_icon.png

    Quote calibre dev:

    feel free to propose it to the Qt (Qt is what calibre uses for its widgets) developers. They will need to add such an option to the QToolBar/QToolButton/QMenuBar classes.

    Thanks for help,
    Fuzzi

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

      Hi and welcome to the forums.
      You mean you want it to dynamic word wrap and not
      use \n for it ?
      alt text

      setMaximumWidth already exists but for the word wrap, you would have to make a custom QToolButton and handle it yourself. Also you might need to
      override sizeHint() too as as far as i recall it looks at the text and will be unaware if
      you word wrap it in paintEvent.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Fuzzi
        wrote on last edited by
        #3

        Thank you for your reply.

        You mean you want it to dynamic word wrap and not use \n for it ?

        Yes, but now as you name it, I consider it an easy workaround to hardcode the \n. I don't know why anyone would like extremely wide buttons better than 2 lines with a minimal loss in vertical space.

        Combined with setMaximumWidth that's already an acceptable solution to me. I'll forward it to the calibre devs and may ask back.

        I hope I don't forget it, but if you don't hear back from me the next two weeks, you can close this as solved :-)

        Thank you!

        p.s.: Do you have a link to the wiki for me? I clicked around a bit but I'm insecure if I've found the right articles. I'm not a dev in that field. I guess there's also a setMinimumWidth?

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Fuzzi
          wrote on last edited by
          #4

          Ok, the calibre dev already has solved the issue.
          Thanks for your help!

          mrjjM 1 Reply Last reply
          1
          • F Fuzzi

            Ok, the calibre dev already has solved the issue.
            Thanks for your help!

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

            @Fuzzi
            Ok super. So you got your more compact buttons?
            Seems like a nice project.

            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