A couple of questions about QML Plasma bindings

Marco Martin notmart at gmail.com
Sat Mar 19 19:58:23 CET 2011


On Saturday 19 March 2011, Sebastian Kügler wrote:
> On Saturday, March 19, 2011 11:05:27 Marco Martin wrote:
> > On Friday 18 March 2011, Diego Casella ([Po]lentino) wrote:
> > > * I'd like to show a tooltip when the applet is collapsed into an icon
> > > in
> > > the panel but, still, there are no QML bindings to
> > > Plasma::ToolTipContent
> > > and ToolTipManager classes.
> > > 
> > >   Is there any chances to get it exposed to QML?
> > 
> > hm, no, unfortunately at the moment there isn't any way..
> > i should come up with something
> > I *think* tha writing a ToolTipData element (just a qobject) that has the
> > usual tooltip data as properties, it could then register its parent if
> > it't a qgraphicsitem to the plasma tooltip manager.
> > it would remain the unpretty thing of being possible to put two or more
> > tooltip datas as child of any given item and this kinda sucks
> 
> Or maybe that's very handy, in the case you want to overwrite the "general
> tooltip" for a specific item inside that widget.

hm, don't think it would really work, since the qml for that would be 
something like
Text {
  text: "foobar"
  PlasmaCore.ToolTipData {
       icon: QIcon("konqueror")
       title: " foo"
       subtext: "bar"
  }
}

so having two ToolTipData children of Text is very useless (and with an 
undeterministic behaviour)
it could be useful indeed having another TooltipData for an itm that is a 
child of that Text {}

another approach would be putting the pointer to the widget in the tooltipdata 
itself, i dunno why it doesn't seem very elegant to me as a first glance but 
it would be way more robust:


Text {
  id:textItem
  text: "foobar"
}

 PlasmaCore.ToolTipData {
       item: textItem
       icon: QIcon("konqueror")
       title: " foo"
       subtext: "bar"
  }

> > (or the tooltip data could be registered in the qscriptengine and
> > created/assigned in an imperative way)
> 
> My feeling is that tooltips belong to a specific item / element.
> 

yup, there is an 1:1 association between widget and tooltip for me as well :)

Cheers,
Marco Martin


More information about the Plasma-devel mailing list