Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMenuBar background image overlays Qmenu text when width of window is small
Qt 6.12 LTS is out! See what's new in the release blog

QMenuBar background image overlays Qmenu text when width of window is small

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 383 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.
  • H Offline
    H Offline
    HowitzerDev
    wrote on last edited by HowitzerDev
    #1

    Hello,

    We use QSS to style the qmenubar and qmenu. For qmenubar it looks like this:

    QMenuBar {	
        background: white no-repeat right center url(foobar.png);   
    }
    

    This works fine and puts the image in the right of the menubar. But when you shrink the width of the app window such that the background image touches and mixes with the qmenus in the qmenubar, the image overlays the qmenus and it doesn't look good. I don't think the qmenu qss has anything relevant in it.

    Is there a way to make it so the image dissappears behind the qmenu?

    QMenuBar with image on right when window is large enough :

    no_mix.png

    Problem when window width is small and mix happens:

    problem.png

    "this is test" is an image.

    QT version 5.15
    Platform Windows

    Thanks,
    Adam

    Chris KawaC 1 Reply Last reply
    0
    • H HowitzerDev

      Hello,

      We use QSS to style the qmenubar and qmenu. For qmenubar it looks like this:

      QMenuBar {	
          background: white no-repeat right center url(foobar.png);   
      }
      

      This works fine and puts the image in the right of the menubar. But when you shrink the width of the app window such that the background image touches and mixes with the qmenus in the qmenubar, the image overlays the qmenus and it doesn't look good. I don't think the qmenu qss has anything relevant in it.

      Is there a way to make it so the image dissappears behind the qmenu?

      QMenuBar with image on right when window is large enough :

      no_mix.png

      Problem when window width is small and mix happens:

      problem.png

      "this is test" is an image.

      QT version 5.15
      Platform Windows

      Thanks,
      Adam

      Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @HowitzerDev Menu bar items have a transparent background by default, so the menu bar will be visible. You can style the items to have opaque background using QMenuBar:item style and that will cover the menu bar background under the items.

      1 Reply Last reply
      2
      • H HowitzerDev has marked this topic as solved on

      • Login

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