D21860: Set a font for gtk applications in the fonts kcm

Mikhail Zolotukhin noreply at phabricator.kde.org
Mon Aug 26 20:39:23 BST 2019


gikari added inline comments.

INLINE COMMENTS

> broulik wrote in fonts.cpp:607
> kded (the application you're running in) is a `QApplication`, so from the constructor of your kdedmodule you could do
> 
>   #include <QApplication>
>   connect(qApp, &QGuiApplication::fontChanged, this, [this](this QFont &font) {
>       // now check if you have the new fonts
>   });
> 
> I can't guarantee this will work (accessing `font` from there will actually deadlock :D but I am curious whether that signal is emitted properly, so you dont have to listen to or ask the font kcm to tell you.

So, I wrote this:

  GtkConfig::GtkConfig(QObject *parent, const QVariantList&) :
      KDEDModule(parent), configEditor {new ConfigEditor()}
  {
      qDebug() << "Parent: " << parent;
      QGuiApplication *qapp = static_cast<QGuiApplication *>(parent);
      qDebug() << "Qapp: " << qapp;
      connect(qapp, &QGuiApplication::fontChanged, this, [this](const QFont &font) {
          qDebug() << "Font recieved";
          qDebug() << font;
      });
      qDebug() << "GTK configuration module loaded";
  }

And when I save fonts via KCM nothing (Except the "parent", "qapp" and "GTK ..." lines) was printed in konsole, where I run Kded5.  So, it means signal was not send?

REPOSITORY
  R119 Plasma Desktop

REVISION DETAIL
  https://phabricator.kde.org/D21860

To: gikari, #plasma, apol, davidedmundson
Cc: davidedmundson, nicolasfella, broulik, GB_2, abetts, ngraham, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190826/a9554987/attachment.html>


More information about the Plasma-devel mailing list