Results 1 to 2 of 2

Thread: Notify style change to all Qt apps

  1. #1
    Join Date
    Sep 2015
    Posts
    7
    Thanks
    2

    Default Notify style change to all Qt apps

    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:

    Qt Code:
    1. void ThemeManagerUI::notifyConfigurationChange()
    2. {
    3. qDebug() << "notifyConfigurationChange()";
    4.  
    5. QByteArray stamp;
    6. QDataStream s(&stamp, QIODevice::WriteOnly);
    7. s << QDateTime::currentDateTime();
    8.  
    9. QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_");
    10. settings_atom_name += XDisplayString(QX11Info::display());
    11.  
    12. xcb_connection_t *xcb_conn = QX11Info::connection();
    13. xcb_intern_atom_cookie_t cookie = xcb_intern_atom(xcb_conn, false, settings_atom_name.size(), settings_atom_name.constData());
    14. xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_conn, cookie, 0);
    15. xcb_atom_t atom = reply->atom;
    16. free(reply);
    17.  
    18. xcb_change_property(xcb_conn, XCB_PROP_MODE_REPLACE, QX11Info::appRootWindow(), atom, XCB_ATOM_ATOM,
    19. 8, stamp.size(), (const void *)stamp.constData());
    20.  
    21. //XChangeProperty(QX11Info::display(), QX11Info::appRootWindow(0),
    22. //ATOM(_QT_SETTINGS_TIMESTAMP), ATOM(_QT_SETTINGS_TIMESTAMP), 8,
    23. //PropModeReplace, (unsigned char *)stamp.data(), stamp.size());
    24. }
    To copy to clipboard, switch view to plain text mode 

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

    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Notify style change to all Qt apps

    Maybe your style plugin needs to react to this somehow?

    Cheers,
    _

Similar Threads

  1. Replies: 3
    Last Post: 1st October 2014, 05:29
  2. Qt Creator Change code style for C++
    By htroyo in forum Qt Tools
    Replies: 3
    Last Post: 14th September 2012, 23:12
  3. kde style for qt apps on windows
    By ivareske in forum Qt Programming
    Replies: 3
    Last Post: 14th March 2011, 22:21
  4. How to change the style of QTabWidget
    By iamjayanth in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2009, 12:07
  5. QPSQL && table change notify
    By Sergey B. in forum Qt Programming
    Replies: 0
    Last Post: 3rd May 2007, 15:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.