Skip to content

Commit 8e25f45

Browse files
committed
app: add spacebar playback control
1 parent 0b484ea commit 8e25f45

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

app/viewer/mediapanel.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ MediaPanel::MediaPanel(QWidget *parent) :
4444

4545
m_PlayBtn = new QPushButton(tr("Play"));
4646
m_PlayBtn->setCheckable(true);
47+
m_PlayShortcut = new QShortcut(QKeySequence(Qt::Key_Space), this);
4748
connect(m_PlayBtn, &QPushButton::clicked, this, &MediaPanel::Play);
49+
connect(m_PlayShortcut, &QShortcut::activated, this, [this]() { Play(!IsPlaying()); });
4850
ctrl_layout->addWidget(m_PlayBtn);
4951

5052
//FinishLayout();

app/viewer/mediapanel.h

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern "C" {
1717
#include <QCheckBox>
1818
#include <QLabel>
1919
#include <QPushButton>
20+
#include <QShortcut>
2021
#include <QSlider>
2122
#include <QTimer>
2223
#include "panel.h"
@@ -188,6 +189,7 @@ class MediaPanel : public Panel
188189

189190
QSlider *m_PlayheadSlider;
190191
QPushButton *m_PlayBtn;
192+
QShortcut *m_PlayShortcut;
191193
QTimer *m_PlaybackTimer;
192194
qint64 m_PlaybackStart;
193195
float m_PlaybackOffset;

0 commit comments

Comments
 (0)