PDA

View Full Version : Context sensitive help on OS X



wconstan
22nd December 2009, 04:13
For nearly all of the widgets in my application I have set the whatsThis property. For Windows, my understanding is that I don't need to do anything special to get context sensitive help: just highlight the widget and press Shift+F1. However, I need to accommodate OS X and LINUX users as well. As it stands, I have a checkable button on a toolbar that I have designated to toggle the display of context sensitive help for OS X. The relevant code is:


void myClass::contextHelp()
{
if (ui->toolbarActionContextHelp->isChecked())
{
QWhatsThis::enterWhatsThisMode();
}
else
{
QWhatsThis::leaveWhatsThisMode();
}
}

void myClass::on_toolbarActionContextHelp_triggered()
{
contextHelp();
}


This is very rudimentary and doesn't function well: I can click on the toolbarActionContextHelp button, which toggles the button to a checked state, and then move over a given widget in my app and left click on it. If that widget contains whatsThis content, it is displayed per usual. However, I cannot then select a second widget (by left clicking) to display its whatsThis contents because the action of left clicking (again) makes my app leave context sensitive mode.

Ultimately what I would want is the following: if the toolbarActionContextHelp button is checked, I would like to be able to simply mouse-over (and not left click) a widget to bring up its context sensitive help. Then to turn it off, I would simply toggle the toolbarActionContextHelp button again.

Q1: Is there a way that I can programmatically set this for all widgets in my application?

Q2: In general, is there a better way to handle this for OS X?

Finally, I obviously don't want to disrupt the native context sensitive help available in Windows via Shift+F1.

Thanks for your help!

axeljaeger
8th January 2010, 12:14
Use QAction * QWhatsThis::createAction ( QObject * parent = 0 ) [static]