Merge pull request #2403 from WizardCM/dock-context

UI: Use OBS dock menu instead of Qt dock context menu
master
Jim 2020-02-16 09:52:47 -08:00 committed by GitHub
commit fd244a6896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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));
}

View File

@ -834,6 +834,8 @@ private slots:
void on_actionVerticalCenter_triggered();
void on_actionHorizontalCenter_triggered();
void on_customContextMenuRequested(const QPoint &pos);
void on_scenes_currentItemChanged(QListWidgetItem *current,
QListWidgetItem *prev);
void on_scenes_customContextMenuRequested(const QPoint &pos);