UI: Use OBS dock menu instead of Qt dock context menu

This commit is contained in:
Matt Gajownik
2020-02-14 23:30:34 +11:00
committed by jp9000
parent 7f373edbea
commit 8a0cfc5665
2 changed files with 17 additions and 0 deletions

View File

@@ -206,6 +206,10 @@ OBSBasic::OBSBasic(QWidget *parent)
setAcceptDrops(true);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this,
SLOT(on_customContextMenuRequested(const QPoint &)));
api = InitializeAPIInterface(this);
ui->setupUi(this);
@@ -7773,3 +7777,14 @@ void OBSBasic::ResetStatsHotkey()
foreach(OBSBasicStats * s, list) s->Reset();
}
void OBSBasic::on_customContextMenuRequested(const QPoint &pos)
{
QWidget *widget = childAt(pos);
const char *className = nullptr;
if (widget != nullptr)
className = widget->metaObject()->className();
if (!className || strstr(className, "Dock") != nullptr)
ui->viewMenuDocks->exec(mapToGlobal(pos));
}