mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-11 23:37:52 +00:00
Implemented wheel event for volume control in VolumeButton
This commit is contained in:
parent
99b8976a5f
commit
346d5f99ef
2 changed files with 53 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
|
||||
|
@ -137,6 +138,28 @@ namespace VkDeviceInfo {
|
|||
class Record;
|
||||
}
|
||||
|
||||
class VolumeButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VolumeButton(QWidget* parent = nullptr) : QPushButton(parent), scroll_multiplier(1) {
|
||||
connect(&scroll_timer, &QTimer::timeout, this, &VolumeButton::ResetMultiplier);
|
||||
}
|
||||
|
||||
signals:
|
||||
void VolumeChanged();
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
private slots:
|
||||
void ResetMultiplier();
|
||||
|
||||
private:
|
||||
int scroll_multiplier;
|
||||
QTimer scroll_timer;
|
||||
constexpr static int MaxMultiplier = 8;
|
||||
};
|
||||
|
||||
class GMainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -481,7 +504,7 @@ private:
|
|||
QPushButton* dock_status_button = nullptr;
|
||||
QPushButton* filter_status_button = nullptr;
|
||||
QPushButton* aa_status_button = nullptr;
|
||||
QPushButton* volume_button = nullptr;
|
||||
VolumeButton* volume_button = nullptr;
|
||||
QWidget* volume_popup = nullptr;
|
||||
QSlider* volume_slider = nullptr;
|
||||
QTimer status_bar_update_timer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue