- Deprecated:
- since CamiTK 2.0
- Note
- this class is deprecated, please use the Action framework.
Generic class for Component popup menu. To create your own Component popup, create a class that inherits from this one. Your class could have as many slot that you want. Create popup menu item and connect your slot using the addAction method.
Example:
*
*
*
*
* Q _ OBJECT
*
* public:
*
* public slots:
* void test();
* };
*
*
*
*
*
* #include "ExampleComponentPopup.h"
* #include "ExampleComponent.h"
* #include <QMessageBox>
* using namespace camitk;
*
* addAction("action test", SLOT(test()), true);
* }
*
* void ExampleComponentPopup::test() {
*
*
*
*
*
* QString testMessage;
*
*
*
* testMessage = QString("This is a test on \"%1\" .\nNice isn't it?").arg(QString(myComponent->getName()));
*
* QMessageBox::information( 0, "Test", testMessage);
*
* }
*
*
*
*
* ...
* public:
*
* virtual QMenu * getPopupMenu(QWidget* parent);
* ...
* private:
*
* QMenu * myPopupMenu;
* ...
*
*
*
*
* #include "ExampleComponentPopup.h"
* ...
*
* myPopupMenu = NULL;
* ...
*
* delete myPopupMenu;
* myPopupMenu = NULL;
* ...
* QMenu * ExampleComponent::getPopupMenu(QWidget* parent) {
*
* if (!myPopupMenu) {
* myPopupMenu = new ExampleComponentPopup(this,parent);
* }
*
* return myPopupMenu;
* }
*
* ...
*