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. QMenu and setChceckable Spacing and Text alignment
QtWS25 Last Chance

QMenu and setChceckable Spacing and Text alignment

Scheduled Pinned Locked Moved Solved General and Desktop
qmenucheckablealignmentmenu
3 Posts 1 Posters 490 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.
  • J Offline
    J Offline
    Jammin44fm
    wrote on 17 Mar 2024, 23:59 last edited by
    #1

    In Qt 5.12, using a checkable Action in a QMenu would insert a tick in the blank space to the left of the menu Item.

    In Qt 5.15, there was bug that resulted in checkable Menu items being offset with additional spacing for the check, which made them appear unaligned, relative to other non-chackable menu items.

    In Qt 6.5, checkable Menu items now appear aligned again, however the entire Menu is now further intended to the right. So there is extra unused space for most of the menu Items, and checkable items appear with a check, and then a space, and then the text for the menu item.
    Is it possible to have All Menu items have their text be aligned, but still only have the single icons worth of space be used? If so how?

    I've added an image showing the Menu with a single check item, that also has the extra space after the Checked item ( that i want to remove ), and the other menu items have double spacing next to them.
    un aligned checked menu item.png

    Cheers,
    James

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jammin44fm
      wrote on 18 Mar 2024, 04:18 last edited by Jammin44fm
      #2

      I can't seem to repro it in a simple example :(

      I am using a custom icon / png to indicate the checked state of the menu Item,
      that is a difference from the basic example i constructed.

      If anyone has a guess as to why my menu's are not behaving in the expected manner i'd love to hear it!

      J 1 Reply Last reply 18 Mar 2024, 05:49
      0
      • J Jammin44fm
        18 Mar 2024, 04:18

        I can't seem to repro it in a simple example :(

        I am using a custom icon / png to indicate the checked state of the menu Item,
        that is a difference from the basic example i constructed.

        If anyone has a guess as to why my menu's are not behaving in the expected manner i'd love to hear it!

        J Offline
        J Offline
        Jammin44fm
        wrote on 18 Mar 2024, 05:49 last edited by
        #3

        @Jammin44fm

        OK I've solved it.

        The entire application has a Stylesheet applied, including settings for a QMenu, and QMenu item, with custom padding.
        By overriding the padding for the specific Menu in question I am setting the left padding to be the check icon size smaller than the normal padding size.
        Now when the menu is draw it is consistent in padding size with all other menu's.

        I still dont think i should have to do it this way, but it's working.

        1 Reply Last reply
        0
        • J Jammin44fm has marked this topic as solved on 18 Mar 2024, 05:49

        1/3

        17 Mar 2024, 23:59

        • 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