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. [Solved] setting a stylesheet on QTextEdit also modifies its context menu - how to preserve context menu style?
Forum Updated to NodeBB v4.3 + New Features

[Solved] setting a stylesheet on QTextEdit also modifies its context menu - how to preserve context menu style?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 7.1k 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.
  • Q Offline
    Q Offline
    qttrekker
    wrote on last edited by
    #1

    I'm trying to set a stylesheet on a QTextEdit box to give it a black background with white text. The code below works but it also changes the background of the context menu in the QTextEdit box. How can I preserve the style of the context menu while also changing the background color of the QTextEdit box?
    @
    box = new QTextEdit;
    box->setReadOnly(true);
    box->setStyleSheet("background: #000000; color: #ffffff");
    @

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Try to set
      @
      QTextEdit {background: #000000; color: #ffffff;}
      @

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qttrekker
        wrote on last edited by
        #3

        That fixed it! Thanks for the tip.

        1 Reply Last reply
        0

        • Login

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