[Qgis-developer] Adding Context Help

Gary Sherman sherman at mrcc.com
Sun Jul 23 18:41:39 EDT 2006


To add context help to a dialog:
1. Add the identifier to the header file for the dialog class:
       static const int context_id = 1173513647;

2. Include the header in the class implementation (.cpp) file:
     #include "qgscontexthelp.h"

3. Add a helpInfo() function to the class and add the call to run the  
help viewer:
    void QgsNewConnection::helpInfo()
    {
      QgsContextHelp::run(context_id);
    }

4. Connect the Help button on the dialog to the helpInfo() function

The context id is generated based on the class name. You can stub in  
-1 and I'll add the appropriate id. If you want to generate the id  
yourself and you have Ruby installed, you can do it by running irb  
(the interactive ruby interpreter) and calling the hash method on  
your class name:

irb(main):001:0> "QgsMyClass".hash
=> -923915736

The resulting number is the unique context_id.

-gary
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Gary Sherman
Micro Resources: http://mrcc.com
   *Geospatial Hosting
   *Web Site Hosting
"We work virtually everywhere"
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-






More information about the Qgis-developer mailing list