mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Toggles visible of FloatingWidget by context-menu actions
This commit is contained in:
parent
4f394ddf5e
commit
2a5849a266
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ public:
|
||||
private slots:
|
||||
void onActionAddSectionContentTriggered();
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent* e);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
ads::ContainerWidget* _container;
|
||||
|
Loading…
Reference in New Issue
Block a user