Tooltips to QML: PlasmaCore.Dialog questions

Mark markg85 at gmail.com
Mon Jun 4 09:24:34 UTC 2012


On Mon, Jun 4, 2012 at 11:01 AM, Marco Martin <notmart at gmail.com> wrote:

> On Sunday 03 June 2012, Mark wrote:
> > Hi,
> >
> > Since "some" people seem to blame me a little for asking question in
> > private mails.. I will throw a bunch of questions in the list.
> >
> > For starters, my tooltip "endeavors" are really starting to show now. I
> got
> > the tooltip somewhat working with nice red text in it and a nice red
> square
> > for the icon. That's all in QML and that's working fine.
> > The issues i seem to be getting are related to window hints and the
> dialog
> > itself.
>
> you can take a look at the widget explorer in kde-
> workspace/libs/plasmagenericshell/widgetsexplorer/package/contents/ui
>
> it has a thing that behaves like a tooltip even if with custom content
>

Will do that.

>
> > Just FYI, here is the - very basic and primitive - QML thus far:
> > http://paste.kde.org/492464/ not complicated at all. And if you're
> > wondering.
> > The "ToolTipData" is just the PRIVATE class "ToolTip" exposed to QML
> > through: rootContext()->setContextProperty("ToolTipData", this); (this =
> > class ToolTip)
> > ScreenGeometry is: rootContext()->setContextProperty("ScreenGeometry",
> > QApplication::desktop()->screenGeometry());
>
> i wonder if there should also be an option to put a generic Component in it
> besides the usual tooltipdata properties, but is probably overkill right
> now
>

I was thinking of making a custom component in C++ and exposing that one as
a QML component. For example "ToolTipPrivateData" which just holds all the
data and emits signals when something is changing. Right now that's not
really required but would make it nicer :) Not quite sure yet if i'm going
to do that.


> > Here are the issues i have so far:
> > 1. The current tooltip classes send a pixmap as an icon (ToolTipManager
> ->
> > ToolTipContent -> ToolTip). That's fine, but how do i send the pixmap
> from
> > C++ to QML and actually use it?
>
> import org.kde.qtextracomponents
>
> QPixmapItem {
>  pixmap: myc++class.pixmap
> }
>
> Ahh there it is. I knew there was something. Thank you!


> > 2. Somehow the tooltip itself shows itself just under the middle of the
> > screen when i open it up for the first time. If i hover over another item
> > for an updated tooltip the position corrects itself. I don't know why
> this
> > is happening. The x position seems to be fine, the y position seems to be
> > wrong.
>
> how are you positioning it? dialog.popupPosition? you should position it
> before actually showing it
>

Ehh, how do i use that one? I can't give a position with that function (it
returns a position).

>
> > 3. The tooltip seems to have a minimal width + height of around 100
> pixels.
> > Where is that minimal limit set and how can i get rid of it?
>
> shouldn't have any, it should use whatever width/height the main item has
>

It certainly has something.. I will recheck and come back to you about this
one.

>
> > 4. Which flags do i need to have for a tooltip? If i put Qt.ToolTip in
> it i
> > get double shadows... Right now i have windowFlags:
> > Qt.X11BypassWindowManagerHint in QML (as you can see). No flags are set
> in
> > C++.
>
> yeah, i think bypasswindowmanagerhints is necessary right now :/
>
> K, will do for now.

Thank you for the responses.

>
>
>
> --
> Marco Martin
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20120604/77321bd6/attachment-0001.html>


More information about the Plasma-devel mailing list