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. Different stylesheets in the same window

Different stylesheets in the same window

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 232 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by
    #1

    Hello!

    I am trying to use two differents stylesheets for the same window. I have a DEFINES variable in .pro file that I use to choose and load the correct file. My method is:

    1. I fill the window stylesheet from the Qt designer (rightclicking the dialog and pressing change stylesheet option).
    2. When I get the desired style, I copy all to a file that I save in the resources.
    3. Using the DEFINES variable, I choose which file I want to load in the .cpp

    The problem is, sometimes and some widgets don't change their stylesheet because I have another stylesheet (made in step 1).

    How can I remove this first stylesheet with code? Because I need it in the designer for viewing the stylesheet result.

    Thank you very much!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      If you assign the stylesheet to the top widget ( like the dialog)
      it should replace the old stylesheet if you load
      another styleSheet and apply to the same to object.

      However, you might need to ask Dialog to redraw itself via
      update()

      if its still not refreshed, you can try
      style()->unpolish(this);
      style()->polish(this);

      1 Reply Last reply
      2

      • Login

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