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. Problem with QMacNativeWidget and QApplication::setPalette()
Forum Updated to NodeBB v4.3 + New Features

Problem with QMacNativeWidget and QApplication::setPalette()

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 375 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.
  • S Offline
    S Offline
    sterin
    wrote on last edited by
    #1

    Hi,

    I am trying to integrate a Qt widget as part of a plugin for an application I have no control over, and especially over its event loop. I've tried to follow the sample code at examples/widgets/mac/qmacnativewidget, but it only gets me so far.

    The widget is created and placed correctly, but when I try to set the palette using QApplication::setPalette() to be consistent with the rest of the application nothing happens. Setting the palette of individual widgets does work, though.

    I've created a small GitHub repository at https://github.com/sterin/qmacnativewidget-setpalette-problem with a simplified example and a similar pre-Qt example that works as expected.

    Thanks in Advance!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sterin
      wrote on last edited by SGaist
      #2

      Update: The reason changes to the application palette do not affect QMacNativeWidget is that its constructor sets the palette explicitly. Once the palette is set explicitly, changes to the application palette no longer propagate through the widget.

      The simple solution is to just reset the palette to the default palette

      setPalette( QPalette() );
      

      Once this is done, change to the application palette start affecting the widget and its children.

      [edit: fixed class name SGaist]

      1 Reply Last reply
      1

      • Login

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