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. Set Background Colour of addMenu item
Forum Updated to NodeBB v4.3 + New Features

Set Background Colour of addMenu item

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 877 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.
  • N Offline
    N Offline
    notshure
    wrote on 2 Jul 2013, 18:47 last edited by
    #1

    Hi, using the following code, I am unable to set the background colour for a menubar item.

    @QMenu *configure = menuBar->addMenu(tr("&Configure"));@

    I am able to set the colour for everything else simply by using qApp->setStyleSheet(...) but I have been unsuccessful in getting the background for the menu to change. I'm guessing that since &Configure is a string it needs to be done is a completely different way...

    Thanks for any help!

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Peppy
      wrote on 3 Jul 2013, 22:15 last edited by
      #2

      Eehm... what?

      Set your stylesheets using setStyleSheet to any QWidget, i.e.:
      @
      MyWindow::MyWindow(QWidget* parent = 0)
      : QWidget(parent)
      {
      setStyleSheet("QMenu { }"); // this will set up style for every item
      // this will set up style only for QMenu, which has set up
      // the object name to "objectName" using
      // QMenu->setObjectName(...);
      setStyleSheet("QMenu#objectName { ... }");
      }
      @

      1 Reply Last reply
      0

      1/2

      2 Jul 2013, 18:47

      • Login

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