Notify app style change



  • Hi all,

    I'm writing a themable style engine (QStyle derived). This style comes with a custom app that allows to tweak it. I'd like to notify all Qt apps of style/config changes when I press "apply" button on my app.

    I searched a lot and all I can find is the following code from KDE that does not work:

    void ThemeManagerUI::notifyConfigurationChange()
    {
      qDebug() << "notifyConfigurationChange()";
    
      QByteArray stamp;
      QDataStream s(&stamp, QIODevice::WriteOnly);
      s << QDateTime::currentDateTime();
    
      QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_");
      settings_atom_name += XDisplayString(QX11Info::display());
    
      xcb_connection_t *xcb_conn = QX11Info::connection();
      xcb_intern_atom_cookie_t cookie = xcb_intern_atom(xcb_conn, false, settings_atom_name.size(), settings_atom_name.constData());
      xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_conn, cookie, 0);
      xcb_atom_t atom = reply->atom;
      free(reply);
    
      xcb_change_property(xcb_conn, XCB_PROP_MODE_REPLACE, QX11Info::appRootWindow(), atom, XCB_ATOM_ATOM,
                          8, stamp.size(), (const void *)stamp.constData());
    
      //XChangeProperty(QX11Info::display(), QX11Info::appRootWindow(0),
                      //ATOM(_QT_SETTINGS_TIMESTAMP), ATOM(_QT_SETTINGS_TIMESTAMP), 8,
                      //PropModeReplace, (unsigned char *)stamp.data(), stamp.size());
    }
    

    This code is from KDE KStyle KCM module but I have no luck. Do you have any idea ?

    Thank you


  • Lifetime Qt Champion

    Hi,

    I'd recommend contacting the KDE folks directly about that matter.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.