Tooltips to QML: PlasmaCore.Dialog questions

Marco Martin notmart at gmail.com
Mon Jun 4 09:01:30 UTC 2012


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

> 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

> 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
}

> 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

> 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

> 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 :/




-- 
Marco Martin


More information about the Plasma-devel mailing list