My wife was missing this applet, after migrating to Plasma 5.
Therefore I had to learn how to write QML-based plasma applets :-)
Details
- Reviewers
davidedmundson - Group Reviewers
Plasma - Commits
- R114:2e0fd299caba: Port the dict applet to KF5 and QtQuick 2
- Adding dict applet to desktop, works.
- Looking up definitions, work.
- Clicking on a link, works.
- Hi-dpi support, works.
- Configuration dialog to choose dictionary: done in a followup commit.
Diff Detail
- Repository
- R114 Plasma Addons
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Cool, thanks!
Adding dict applet to desktop, works.
Have you added it to the panel?
applets/dict/package/contents/ui/main.qml | ||
---|---|---|
21 | then use font metrics...http://doc.qt.io/qt-5/qml-qtquick-fontmetrics.html or in this Plasmoid case use Units.gridUnit * 40 which is gonna be basically the same. | |
38 | it's a bit rubbish, but: zoom: Units.devicePixelRatio should sort out DPI. | |
applets/dict/package/metadata.desktop | ||
118–119 | no it doesn't | |
applets/dict/plugin/dict_object.h | ||
3 | Plasma core provides a dataengine QML exposer. Is there a reason we made a specialised QML wrapper? |
applets/dict/package/contents/ui/main.qml | ||
---|---|---|
5 | Ah, yes. That was for "formFactor" as in https://techbase.kde.org/Development/Tutorials/Plasma5/QML2/GettingStarted#Minimum_size But I'm not sure if I need to handle form factors in this applet, and if so, how... | |
21 | Oh, cool, FontMetrics didn't exist in my first QML attempts. But yeah if plasmoids should fit a grid, I'll use the grid then. | |
34 | Layout.fillHeight: true led to a 1-pixel-high webview, not good. Layout.fillWidth: true is good, it means I don't duplicate the width anymore. OK, and doing that in the TextField makes the applet resize to the user's wishes, I see. Thanks. | |
38 | zoomFactor: units.devicePixelRatio | |
applets/dict/package/metadata.desktop | ||
118–119 | Indeed. One day it should, though, I'd like the user to be able to choose which dict to use. Do I have to write a config dialog in QML, though? If so, any example I can use for that? | |
applets/dict/plugin/dict_object.h | ||
3 | Ah, I didn't know. |
applets/dict/package/contents/ui/main.qml | ||
---|---|---|
34 | Hmm, but the user should be able to resize the applet vertically too... I get very confusing behaviour even with It resizes down to very little, jumps around in the desktop, etc. |
What should happen when I do? Surely a webview won't fit there...
We should show an icon (like a dictionary or something)
which will show the popup with the relevant plasmoid.
In theory this should all happen automatically if the minimum size hints of your full main.qml are too massive for a panel and we get a "compact representation" instead.
applets/dict/plugin/dict_object.cpp | ||
---|---|---|
43 | Why you prefer invoke rather than a signal ? |
Hey that actually works out of the box, it's magic :-)
applets/dict/plugin/dict_object.cpp | ||
---|---|---|
43 | Heh, I just didn't think of that, when I turned the direct call into invokeMethod to fix the threading issue. Indeed a signal is much simpler, removes the need for m_dict altogether. |