diff --git a/app/src/MainWindow.cpp b/app/src/MainWindow.cpp index 2e6506b..3e6f828 100644 --- a/app/src/MainWindow.cpp +++ b/app/src/MainWindow.cpp @@ -182,10 +182,16 @@ MainWindow::MainWindow(QWidget *parent) connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(), SLOT(onTimeToUpdate(SqpDateTime))); - // Variable + // Widgets / widgets connections qRegisterMetaType >(); - connect(&sqpApp->visualizationController(), SIGNAL(variableCreated(std::shared_ptr)), - m_Ui->view, SLOT(displayVariable(std::shared_ptr))); + + // For the following connections, we use DirectConnection to allow each widget that can + // potentially attach a menu to the variable's menu to do so before this menu is displayed. + // The order of connections is also important, since it determines the order in which each + // widget will attach its menu + connect(m_Ui->variableInspectorWidget, + SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, std::shared_ptr)), m_Ui->view, + SLOT(attachVariableMenu(QMenu *, std::shared_ptr)), Qt::DirectConnection); /* QLopGUI::registerMenuBar(menuBar()); this->setWindowIcon(QIcon(":/sciqlopLOGO.svg"));