Skip to content

Commit c7a23bb

Browse files
committed
Menu
1 parent d452327 commit c7a23bb

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/Interface/Application/ModuleWidget.cc

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,23 @@ void ModuleWidget::postLoadAction()
548548
void ModuleWidget::showReplaceWithWidget()
549549
{
550550
qDebug() << __FUNCTION__;
551-
QMessageBox msgBox;
551+
/*QMessageBox msgBox;
552552
QPushButton *connectButton = msgBox.addButton("Replacement", QMessageBox::ActionRole);
553+
qDebug() << replaceWithWidget_->menu()->actions().size();
553554
connectButton->setMenu(replaceWithWidget_->menu());
554555
QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);
555556
msgBox.setText("Press button to replace.");
556-
msgBox.exec();
557+
558+
QDialog dialog;
559+
auto l = new QHBoxLayout;
560+
auto b = new QPushButton("Replacement");
561+
auto menu = new QMenu(this);
562+
b->setMenu(menu);
563+
fillReplaceWithMenuImpl(menu);
564+
l->addWidget(b);
565+
dialog.setLayout(l);
566+
dialog.exec();
567+
*/
557568
}
558569

559570
bool ModuleWidget::guiVisible() const
@@ -568,7 +579,14 @@ void ModuleWidget::fillReplaceWithMenu()
568579
if (deleting_ || networkBeingCleared_)
569580
return;
570581

571-
auto menu = getReplaceWithMenu();
582+
fillReplaceWithMenuImpl(getReplaceWithMenu());
583+
}
584+
585+
void ModuleWidget::fillReplaceWithMenuImpl(QMenu* menu)
586+
{
587+
if (deleting_ || networkBeingCleared_)
588+
return;
589+
572590
menu->clear();
573591
LOG_DEBUG("Filling menu for " << theModule_->get_module_name() << std::endl);
574592
auto replacements = Application::Instance().controller()->possibleReplacements(this->theModule_);

src/Interface/Application/ModuleWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ private Q_SLOTS:
279279
QMenu* getReplaceWithMenu();
280280
void setInputPortSpacing(bool highlighted);
281281
void setOutputPortSpacing(bool highlighted);
282+
void fillReplaceWithMenuImpl(QMenu* menu);
282283

283284
class ModuleLogWindow* logWindow_;
284285
boost::scoped_ptr<class ModuleActionsMenu> actionsMenu_;

0 commit comments

Comments
 (0)