Added WhatsThis feature to Mussa.
authorBrandon King <kingb@caltech.edu>
Tue, 28 Feb 2006 00:27:37 +0000 (00:27 +0000)
committerBrandon King <kingb@caltech.edu>
Tue, 28 Feb 2006 00:27:37 +0000 (00:27 +0000)
To use this feature, take any QWidget inherited object and call:

widget->setWhatsThis(tr("Long description"));

That's it!

qui/PathWindow.cxx
qui/PathWindow.h

index 477270a90092f5b03394a32945dc6cb782e4e3d8..488a3f9db03740921624ff16da9bf379ae076578 100644 (file)
@@ -9,6 +9,7 @@
 #include <QStatusBar>
 #include <QString>
 #include <QToolBar>
+#include <QWhatsThis>
 
 #include "qui/PathScene.h"
 #include "qui/ThresholdWidget.h"
@@ -22,6 +23,10 @@ PathWindow::PathWindow(QWidget *) :
   setupMainMenu();
 
   scene = new PathScene(10000, 10, this);
+  //This next setWhatsThis function prevents
+  // a segfault when using WhatsThis feature with 
+  // opengl widget.
+  scene->setWhatsThis(tr("Mussa in OpenGL!"));
   setCentralWidget(scene);
 
   mussaViewTB = new QToolBar("Path Views");
@@ -90,9 +95,14 @@ void PathWindow::setupActions()
   toggleMotifsAction = new QAction(tr("Toggle Motifs"), this);
   connect(toggleMotifsAction, SIGNAL(triggered()), 
           this, SLOT(toggleMotifs()));
-
   toggleMotifsAction->setCheckable(true);
   toggleMotifsAction->setIcon(QIcon("icons/motif_icon.png"));
+  toggleMotifsAction->setWhatsThis(tr("Toggle motif annotations on/off\n\n"
+                                  "You can load motif annotations via "
+                                  "'File->Load Motif List' menu option."));
+
+  whatsThisAction = QWhatsThis::createAction(this);
+  whatsThisAction->setIcon(QIcon("icons/help.png"));
 }
 
 void PathWindow::setupMainMenu()
@@ -116,6 +126,8 @@ void PathWindow::setupMainMenu()
   newMenu->addAction(showMussaViewToolbarAction);
 
   newMenu = menuBar()->addMenu(tr("&Help"));
+  newMenu->addAction(whatsThisAction);
+  newMenu->addSeparator();
   newMenu->addAction(aboutAction);
 }
   
index b98bb442526bb86fb93b3d8fb1ab20fc80d540f8..86d73525749b7d83328d85a96814f3d1255c5371 100644 (file)
@@ -56,6 +56,7 @@ protected:
   QAction *saveMotifListAction;
   QAction *showMussaViewToolbarAction;
   QAction *toggleMotifsAction;
+  QAction *whatsThisAction;
 
   //! initialze the actions
   void setupActions();