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. QTextEdit - unable to modify base color
QtWS25 Last Chance

QTextEdit - unable to modify base color

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 219 Views
  • 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.
  • V Offline
    V Offline
    viniltc
    wrote on 28 May 2020, 11:16 last edited by
    #1

    Hi All,

    I've a QTextEdit called secondsText, I need to change the base color, so I tried as follows in the constructor, which doesn't work:

    QPalette p = ui->secondsText->palette();
    p.setColor(QPalette::Base, Qt::green);
    ui->secondsText->setPalette(p);
    

    Base color is still the default (white), what might be the issue?

    J 1 Reply Last reply 28 May 2020, 11:20
    0
    • V viniltc
      28 May 2020, 11:16

      Hi All,

      I've a QTextEdit called secondsText, I need to change the base color, so I tried as follows in the constructor, which doesn't work:

      QPalette p = ui->secondsText->palette();
      p.setColor(QPalette::Base, Qt::green);
      ui->secondsText->setPalette(p);
      

      Base color is still the default (white), what might be the issue?

      J Online
      J Online
      JonB
      wrote on 28 May 2020, 11:20 last edited by JonB
      #2

      @viniltc said in QTextEdit - unable to modify base color:

      • Test against QPalette::Text, to verify whether that works on foreground, just so you know.
      • If you have any stylesheet background-color specified, including back up the hierarchy I think, that will override.
      1 Reply Last reply
      2

      1/2

      28 May 2020, 11:16

      • 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