Toggles visible of FloatingWidget by context-menu actions

This commit is contained in:
mfreiholz 2016-02-03 09:15:07 +01:00
parent 4f394ddf5e
commit 2a5849a266
3 changed files with 12 additions and 1 deletions

View File

@ -315,6 +315,7 @@ QMenu* ContainerWidget::createContextMenu() const
QAction* a = m->addAction(QIcon(), QString("Floating %1").arg(c->uid()));
a->setCheckable(true);
a->setChecked(fw->isVisible());
QObject::connect(a, &QAction::toggled, fw, &FloatingWidget::setVisible);
}
}

View File

@ -100,4 +100,11 @@ void MainWindow::onActionAddSectionContentTriggered()
// auto section = new ads::SectionWidget(_container);
// _container->addSection(section);
// section->addContent(content);
}
}
void MainWindow::contextMenuEvent(QContextMenuEvent* e)
{
QMenu* m = _container->createContextMenu();
m->exec(QCursor::pos());
delete m;
}

View File

@ -23,6 +23,9 @@ public:
private slots:
void onActionAddSectionContentTriggered();
protected:
virtual void contextMenuEvent(QContextMenuEvent* e);
private:
Ui::MainWindow *ui;
ads::ContainerWidget* _container;