Wow men didnt know they were being deprecated :S I use the following layout for the menu
Qt Code:
  1. ui->menuBar->setStyleSheet ( "QMenuBar"
  2. "{"
  3. " background-color: qlineargradient( x1:0, y1:0, x2:0, y2:1, "
  4. " stop: 0 #b0c4de, "
  5. " stop: 0.8 #e6e6e8, "
  6. " stop: 1 #b0c4de ); "
  7. " margin: 0px; "
  8. " padding: 5px; "
  9. " spacing: 5px; "
  10. "}"
  11. "QMenuBar::item"
  12. "{"
  13. " background-color: qlineargradient( x1:0, y1:0, x2:0, y2:1, "
  14. " stop: 0 #b0c4de, "
  15. " stop: 0.8 #c8dcf6, "
  16. " stop: 1 #4682b4 ); "
  17. " border-width: 1px; "
  18. " border-color: darkkhaki; "
  19. " border-style: solid; "
  20. " border-radius: 5px; "
  21. " margin: 3px; "
  22. " padding: 4px; "
  23. " spacing: 20px; "
  24. "}"
  25. "QMenuBar::item:selected { /* when selected using mouse or keyboard */"
  26. "background: #a8a8a8;"
  27. "}"
  28. "QMenuBar::item:pressed {"
  29. "background: #888888;"
  30. "}"
  31. "QMenu {"
  32. "background-color: white;"
  33. "margin: 5px; /* some spacing around the menu */"
  34. "width: 180px;"
  35. "}"
  36. "QMenu::item {"
  37. "padding: 10px 28px 10px 23px;"
  38. "font: bold 12px;"
  39. "border: 1px solid transparent; /* reserve space for selection border */}"
  40. "QMenu::item:selected {"
  41. "border-color: darkblue;"
  42. "background: rgba(100, 100, 100, 150);"
  43. "}"
  44. "QMenu::icon:checked { /* appearance of a 'checked' icon */"
  45. "background: gray;"
  46. "border: 1px inset gray;"
  47. "position: absolute;"
  48. "top: 1px;"
  49. "right: 1px;"
  50. "bottom: 1px;"
  51. "left: 1px;}"
  52. "QMenu::separator {"
  53. "height: 2px;"
  54. "background: lightblue;"
  55. "margin-left: 10px;"
  56. "margin-right: 5px;}"
  57. "QMenu::indicator {"
  58. "width: 13px;"
  59. "height: 13px;}"
  60.  
  61. );
To copy to clipboard, switch view to plain text mode