Developing plasmoids with QML

Вика edwardlee at rambler.ru
Thu Feb 7 17:46:03 UTC 2013


Alex Merry, Marco Martin, thank you for your replies. I've already tried IRC and
Helping hands on KDE forum, but my questions were ignored there.

I'm trying to make an applet for easy pasting emoticons in chats. By my design it
should display all emoticons of current system theme and allow to select any
marking of any of selected emoticon (e. g. :-) :) or =) ) and copy it to
clipboard, so as switch between emoticons themes installed. Here is the code:
http://pastebin.com/ay7692hR

It sounds very simple, but I've got numerous troubles (maybe because of having no
experience in QML / KDE development). So here are my questions:

0) Now I use ButtonRow and KDE toolbuttons to display selected emoticon's
marking. On selecting emoticon I make the first button of the ButtonRow checked
as

symbols_buttons.children[0].checked = true

Though that works, it writes `Error: Cannot assign to non-existent property
"checked"` to debug. Is there any way to convert children[i] to Plasma ToolButton
type to avoid that notification?

1) On pressing button "To clipboard" selected marking of selected emoticon should
be copied to clipboard. Forums report that QML cannot access clipboard other than
through wrapped C++ classes. Is that an actual info? Currently I'm using an
invisible textbox a it's method copy(). Is there a more convenient variant (but
without wrapping)?

2) Maybe better way is to use double click to copy to clibboard default marking
of clicked emoticon, while other markings would be accessible through the context
menu. But how can I add items to menu? I've tried as described here
(http://comments.gmane.org/gmane.comp.kde.devel.plasma/20470) but that didn't
help (no class MenuItem found).

3) Using anchors for elements in Row causes error message `Cannot use anchors
inside Row` (though it works fine). But how can I attach some elements in Row to
it's left side and some - to the right one? In ordinary Qt I would use spacers
for that, but QML doesn't contain them.

4) I intended to use ComboBox for displaying current emoticon theme name and icon
near it. I was suprised that QML still has no standard Combo implementation. I've
found Plasma ComboBox in PlasmaGraphicsWidgets, but it has few problems:

4.0) There's something wrong with it's QPainter. Log says:

QPainter::begin: Paint device returned engine == 0, type: 2

QPainter::setCompositionMode: Painter not active

QPainter::end: Painter not active, aborted

How can that be repaired?

4.1) How do I add any item to it through QML?

4.2) It seems not to support model/delegate view. Any ideas?

5) By the way how can I get the list of emoticons themes (both system and
downloaded by user)? Should I just hardcode paths `/usr/share/emoticons/` and
`~/.kde4/share/emoticons` or there's a more elegant way exists? And how can I
programmatically determine/change currently selected emoticon theme?

I have few more questions but they are less important. Hope to get answers for
these ones at first.

Thank you in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20130207/b8234a9d/attachment.html>


More information about the Plasma-devel mailing list