| 46 | |
| 47 | |
| 48 | void ExamplesMenu::addExample(QString caption, QString path, QString tip) |
| 49 | // ---------------------------------------------------------------------------- |
| 50 | // Add an entry to the menu, linking to a particular document |
| 51 | // ---------------------------------------------------------------------------- |
| 52 | { |
| 53 | // If path is relative, prepend the templates directory |
| 54 | if (!path.contains("://") && !QFileInfo(path).isAbsolute()) |
| 55 | path = QCoreApplication::applicationDirPath() + "/templates/" + path; |
| 56 | |
| 57 | QAction * action = new QAction(caption, this); |
| 58 | action->setData(QVariant(path)); |
| 59 | if (tip != "") |
| 60 | action->setToolTip(tip); |
| 61 | connect(action, SIGNAL(triggered()), this, SLOT(actionTriggered())); |
| 62 | |
| 63 | addAction(action); |
| 64 | } |
| 65 | |
| 66 | |
| 67 | void ExamplesMenu::actionTriggered() |