Skip to content
  • 0 Votes
    5 Posts
    948 Views
    B
    @mrjj I have the following stylesheet applied to a containing widget QMenu, QMenu QPushButton { background-color: #303030; color: white } When I remove the QMenu selector, the white line disappears (hence it starts looking like this) [image: 5a161ee4-3e8d-419a-8680-e774d2c01e70.png] I cannot say whether the white line really disappears or it just blends with the white color of the menu item. After applying the same style with a QMenu::item selector, I get the following: [image: 134815d0-278a-4a93-af33-bbdd63c68ea2.png] The ordinary menu items are colored, but those created by my class are not. It appears as if the ::menuItem selector does not work on them. I also tried setting the following style rule on the container returned by the createWidget function container->setStyleSheet(".MenuItem {background-color: #303030; color: white; }"); and it oddly makes the custom menu items get shifted to the left and the hover effects on them do not seem to work any longer. Applying padding/margin does not fix it: [image: e5b252c8-4e60-4a32-b13e-794608842129.png]
  • 0 Votes
    2 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, What about painting a partially transparent rectangle over the part of the text that should be highlighted ? You could draw the text first and then the rectangle over. Hope it helps