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. How to update QIcon on palette change?
Qt 6.11 is out! See what's new in the release blog

How to update QIcon on palette change?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 401 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.
  • S Offline
    S Offline
    schrute
    wrote on last edited by
    #1

    How can I change QIcons already set on QPushButtons, QMenu etc on the application palette change?

    Christian EhrlicherC 1 Reply Last reply
    0
    • S schrute

      How can I change QIcons already set on QPushButtons, QMenu etc on the application palette change?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Listen on QEvent::PaletteChange an apply your changes.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      S 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Listen on QEvent::PaletteChange an apply your changes.

        S Offline
        S Offline
        schrute
        wrote on last edited by
        #3

        @Christian-Ehrlicher This should work for simple cases but what about complex widgets like QTreeWidget where icons are set using a decoration role in a model?

        JonBJ 1 Reply Last reply
        0
        • S schrute

          @Christian-Ehrlicher This should work for simple cases but what about complex widgets like QTreeWidget where icons are set using a decoration role in a model?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @schrute
          At a guess then you need to tell it that the model data has changed for the decoration role, so that it redraws?

          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