I am using C++/Qt 5.5 and in my software, I want the Qt::Key_Space to trigger the opening of a menu, and the same button, to trigger the closing of the same menu. The problem is that if I implement it as:
this->button = new QPushButton();
this->button->setShortcut( QKeySequence( Qt::Key_Space ) );
connect(this->button, &QPushButton::clicked, this, &MenuClass::startMenuButtonClicked);
...
this->in_menu_button = new QPushButton();
this->in_menu_button->setShortcut( QKeySequence( Qt::Key_Space ) );
connect(this->in_menu_button, &QPushButton::clicked, this, &InTheMenuClass::startMenuButtonClicked);
If i do it like this, only one way to the menu works. Do you have any ideas on how to solve this issue?