KConfigXT Support for ToolTips?

Louai Al-Khanji louai.khanji at gmail.com
Sat Apr 5 03:39:20 BST 2008


On Saturday 05 April 2008 05:29:05 Jeff Mitchell wrote:
> Louai Al-Khanji wrote:
> > On Saturday 05 April 2008 02:35:03 Allen Winter wrote:
> >> Howdy,
> >>
> >> I noticed that a <whatsthis> element is supported in *.kcfg files
> >> but <tooltip> is not.
> >>
> >> Why? Is it possible and a good idea to add tooltips?
> >
> > Does whatsthis actually work? I tried using it a while ago after finding
> > it but it seemed broken. I haven't yet had the time to look into it
> > further, might be pebcak.
>
> It works.  Here's an example:
>
> QLabel* m_label_details = new QLabel( "<qt>(<a href='details'>" + i18n(
> "Details" ) + "</a>)</qt>", this ); //clickable label to show whatsthis
> m_label_details->setTextInteractionFlags( Qt::LinksAccessibleByMouse |
> Qt::LinksAccessibleByKeyboard ); //make it actually clickable...important!
> connect( m_label_details, SIGNAL( linkActivated(const QString &) ),
> this, SLOT( slotDetailsActivated(const QString &) ) );
>
> m_details = QString( "<em>%1</em><br />" "<table>%2</table>" ).arg(
> title, table );  //title and table are html
>
> and in slotDetailsActivated:
>
> QWhatsThis::showText( QCursor::pos(), "<qt>" + m_details + "</qt>",
> Amarok::mainWindow() );
>
> <qt> is actually a synonym for <html> IIRC, and yes, it's redundant there.
>
> --Jeff

I was talking specifically about the KConfigXT case. :) I know it works in 
general.

I didn't know about QWhatsThis::showText though, cool.

-- 
Louai Al-khanji




More information about the kde-core-devel mailing list