This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Notify all Qt apps of style change

Tags: None
(comma "," separated)
dextermagnific
Registered Member
Posts
5
Karma
0
OS

Notify all Qt apps of style change

Fri Jan 20, 2017 9:37 am
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:

Code: Select all
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


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]