##// END OF EJS Templates
Creates signal to make dynmaic menu for a variable
Alexandre Leroux -
r247:96c4c8973e0c
parent child
Show More
@@ -24,6 +24,17 public:
24 explicit VariableInspectorWidget(QWidget *parent = 0);
24 explicit VariableInspectorWidget(QWidget *parent = 0);
25 virtual ~VariableInspectorWidget();
25 virtual ~VariableInspectorWidget();
26
26
27 signals:
28 /**
29 * Signal emitted before a menu concerning a variable is displayed. It is used for other widgets
30 * to complete the menu.
31 * @param tableMenu the menu to be completed
32 * @param variable the variable concerned by the menu
33 * @remarks To make the dynamic addition of menus work, the connections to this signal must be
34 * in Qt :: DirectConnection
35 */
36 void tableMenuAboutToBeDisplayed(QMenu *tableMenu, std::shared_ptr<Variable> variable);
37
27 private:
38 private:
28 Ui::VariableInspectorWidget *ui;
39 Ui::VariableInspectorWidget *ui;
29
40
@@ -39,7 +39,8 void VariableInspectorWidget::onTableMenuRequested(const QPoint &pos) noexcept
39 if (auto selectedVariable = model->variable(selectedIndex.row())) {
39 if (auto selectedVariable = model->variable(selectedIndex.row())) {
40 QMenu tableMenu{};
40 QMenu tableMenu{};
41
41
42 /// @todo ALX : make menu
42 // Emit a signal so that potential receivers can populate the menu before displaying it
43 emit tableMenuAboutToBeDisplayed(&tableMenu, selectedVariable);
43
44
44 if (!tableMenu.isEmpty()) {
45 if (!tableMenu.isEmpty()) {
45 tableMenu.exec(mapToGlobal(pos));
46 tableMenu.exec(mapToGlobal(pos));
General Comments 0
You need to be logged in to leave comments. Login now