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. Qt - not all widgets refreshed after stylesheet change

Qt - not all widgets refreshed after stylesheet change

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k 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.
  • K Offline
    K Offline
    Kobid
    wrote on last edited by
    #1

    Hi,
    I have style manager, so user can change stylesheet and palette at runtime. But after this operation, not all widgets are "restyled". New look is applied when widget is recreated. Same code called from main window constructor is working like expected. Is exists any global signal which notify all widgets that they should refresh palette and stylesheet?

    This code is called from modal dialog:
    @QFile file(":/qss/default.qss");
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
    qApp->setStyleSheet(styleSheet);
    QPalette p = qApp->palette();
    p.setColor(QPalette::Window, QColor(53,53,53));
    p.setColor(QPalette::Button, QColor(53,53,53));
    p.setColor(QPalette::Highlight, QColor(175,0,0));
    p.setColor(QPalette::ButtonText, QColor(255,255,255));
    p.setColor(QPalette::WindowText, QColor(255,255,255));
    qApp->setPalette(p)@

    Some widgets apply new palette and stylesheet automatically but some not (like MainMenu where text is still black but should be white). Should I enumerate all widgets and apply palette on each widget?

    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