The "What's This...?" button provides help windows like Quickhelp, but with the intention that the user wants to get help about a certain widget within the working view or a toolbar item. It is placed in the toolbar and gets activated once the user hits the button. The cursor changes to an arrow cursor with a question mark like the button itself looks like. The the user can press on a visible widget item and gets a help window. As an exercise, you could try this behavior with the What's this...? button within KDevelop. To add the What's This...? button, do the following:
include qwhatsthis.h into your sourcecode
add a private member QWhatsThis whats_this/ or with another member name to your KTMainWindow derived class declaration
define a resource id for your what's this button into the resource.h file,e.g. #define ID_HELP_WHATS_THIS 10100
in your method to create the toolbar (usually initToolBar()), add at the location you want to have the button displayed:
whats_this = new QWhatsThis; QToolButton *btnwhat = whats_this->whatsThisButton(toolBar()); QToolTip::add(btnwhat, i18n("What's this...?")); toolBar()->insertWidget(ID_HELP_WHATS_THIS, btnwhat->sizeHint().width(), btnwhat); btnwhat->setFocusPolicy(QWidget::NoFocus); |
finally, add the messages you want to have on a click over a certain widget like this:
whats_this->add(class_tree, i18n("Class Viewer\n\n" "The class viewer shows all classes, methods and variables " "of the current project files and allows switching to declarations " "and implementations. The right button popup-menu allows more specialized " "functionality.")); |