{"id":2230,"date":"2014-12-09T06:22:04","date_gmt":"2014-12-08T22:22:04","guid":{"rendered":"https:\/\/www.csslayer.info\/wordpress\/?p=2230"},"modified":"2014-12-09T06:22:04","modified_gmt":"2014-12-08T22:22:04","slug":"on-porting-fcitx-kcm-module-to-kf5","status":"publish","type":"post","link":"https:\/\/www.csslayer.info\/wordpress\/fcitx-dev\/on-porting-fcitx-kcm-module-to-kf5\/","title":{"rendered":"On porting Fcitx KCM module to KF5"},"content":{"rendered":"<p>Porting Fcitx KCM to KF5 is not that easy. It&#8217;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.<\/p>\n<p>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.<\/p>\n<p>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\u00a0 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.<\/p>\n<p>The keyboard layout previewer in kde4 kcm is not ported yet because there&#8217;s some X11 related library usage, which need to be ported to xcb because Qt5 is using xcb instead of libX11. But overall it&#8217;s usable, and I fixed a quite nasty old bug in KCM too.<\/p>\n<p>I also played a bit with C++ 11 Lambda, and it made my porting job simpler. In old KDialog&#8217;s world, there&#8217;s a signal passes KDialog::ButtonCode. Though QDialogButtonBox also provides QDialogButtonBox::StandardButton, QDialogButtonBox&#8217;s &#8220;clicked&#8221; signal only passes QAbstractButton pointer. So I used following lambda function to preserve the old behavior.<\/p>\n<pre>[this, buttonBox](QAbstractButton* button) {\r\n    this-&gt;buttonClicked(buttonBox-&gt;standardButton(button);\r\n}<\/pre>\n<p>which is quite handy to use.<\/p>\n<p>And here comes a mandatory screenshot, sorry for some Chinese character on it because LANG trick can&#8217;t affect all strings (some come from another process via DBus).<\/p>\n<p><a href=\"https:\/\/www.csslayer.info\/wordpress\/wp-content\/uploads\/2014\/12\/kcm-fcitx1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-2231\" src=\"https:\/\/www.csslayer.info\/wordpress\/wp-content\/uploads\/2014\/12\/kcm-fcitx1-1024x595.png\" alt=\"kcm-fcitx1\" width=\"640\" height=\"371\" srcset=\"https:\/\/www.csslayer.info\/wordpress\/wp-content\/uploads\/2014\/12\/kcm-fcitx1-1024x595.png 1024w, https:\/\/www.csslayer.info\/wordpress\/wp-content\/uploads\/2014\/12\/kcm-fcitx1-300x174.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Porting Fcitx KCM to KF5 is not that easy. It&#8217;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 &hellip; <a href=\"https:\/\/www.csslayer.info\/wordpress\/fcitx-dev\/on-porting-fcitx-kcm-module-to-kf5\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[194],"class_list":["post-2230","post","type-post","status-publish","format-standard","hentry","category-fcitx-dev","tag-planetkde"],"_links":{"self":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts\/2230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/comments?post=2230"}],"version-history":[{"count":1,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts\/2230\/revisions"}],"predecessor-version":[{"id":2232,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts\/2230\/revisions\/2232"}],"wp:attachment":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/media?parent=2230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/categories?post=2230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/tags?post=2230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}