mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
UI: Fix media controls shortcuts being global
The play, pause and restart shortcuts were being called as global shortcuts, being triggered no matter what. This fixes this by calling the shortcut actions only when the media controls widget has focus.
This commit is contained in:
@@ -71,9 +71,6 @@
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Space</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
||||
@@ -69,6 +69,7 @@ MediaControls::MediaControls(QWidget *parent)
|
||||
"MediaControlsCountdownTimer");
|
||||
|
||||
QAction *restartAction = new QAction(this);
|
||||
restartAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
restartAction->setShortcut({Qt::Key_R});
|
||||
connect(restartAction, SIGNAL(triggered()), this, SLOT(RestartMedia()));
|
||||
addAction(restartAction);
|
||||
@@ -86,6 +87,13 @@ MediaControls::MediaControls(QWidget *parent)
|
||||
SLOT(MoveSliderBackwards()));
|
||||
sliderBack->setShortcut({Qt::Key_Left});
|
||||
addAction(sliderBack);
|
||||
|
||||
QAction *playPause = new QAction(this);
|
||||
playPause->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
connect(playPause, SIGNAL(triggered()), this,
|
||||
SLOT(on_playPauseButton_clicked()));
|
||||
playPause->setShortcut({Qt::Key_Space});
|
||||
addAction(playPause);
|
||||
}
|
||||
|
||||
MediaControls::~MediaControls() {}
|
||||
|
||||
Reference in New Issue
Block a user