On porting Fcitx KCM module to KF5

Porting Fcitx KCM to KF5 is not that easy. It’s not only about porting kcm itself, but also porting missing part of fcitx-qt5 to Qt5 (mostly widgets). The old pkgconfig file is quite messed up, so I decided to experiment with extra-cmake-modules (ECM) a bit.

I found that fcitx-qt5 could be nicely split into two sub-modules, so I tried to use similiar CMake trick like KF5. So we now have nicely split FcitxQt5DBusAddons and FcitxQt5WidgetsAddons in fcitx-qt5 repo.

ECM and new cmake provide a standardized way to create find_package cmake scripts and I really like it. Another thing that I want to mention is that target_include_directories(xx INTERFACE xx) is  great. If a library adopts this method, the long list inside include_directories is not required anymore, target_link_libraries will resolve all needed include_directories for you and everything will work like magic.

The keyboard layout previewer in kde4 kcm is not ported yet because there’s some X11 related library usage, which need to be ported to xcb because Qt5 is using xcb instead of libX11. But overall it’s usable, and I fixed a quite nasty old bug in KCM too.

I also played a bit with C++ 11 Lambda, and it made my porting job simpler. In old KDialog’s world, there’s a signal passes KDialog::ButtonCode. Though QDialogButtonBox also provides QDialogButtonBox::StandardButton, QDialogButtonBox’s “clicked” signal only passes QAbstractButton pointer. So I used following lambda function to preserve the old behavior.

[this, buttonBox](QAbstractButton* button) {

which is quite handy to use.

And here comes a mandatory screenshot, sorry for some Chinese character on it because LANG trick can’t affect all strings (some come from another process via DBus).


This entry was posted in fcitx development and tagged . Bookmark the permalink.

3 Responses to On porting Fcitx KCM module to KF5

  1. Eike Hein says:
    Firefox 37.0 GNU/Linux x64

    Nice work!

  2. hedgehog says:
    Firefox 37.0 Windows XP

    希望有純 Qt5 的config module 可以給lxqt 用

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.