From 32568af90e5c521c68432a7e77b6dd8bf524adde Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Wed, 20 Apr 2016 23:29:39 +0800 Subject: UI refinements and fix to two memory leaks. Minor improvement in MIDI reading process. --- qmidiplayer-desktop/qmpmainwindow.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'qmidiplayer-desktop/qmpmainwindow.hpp') diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp index 55e0b12..2f3876d 100644 --- a/qmidiplayer-desktop/qmpmainwindow.hpp +++ b/qmidiplayer-desktop/qmpmainwindow.hpp @@ -7,9 +7,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include "../core/qmpmidiplay.hpp" @@ -24,6 +26,24 @@ namespace Ui { class qmpMainWindow; } +class QClickableSlider:public QSlider +{ + Q_OBJECT + public: + explicit QClickableSlider(QWidget *parent=0):QSlider(parent){} + protected: + void mouseReleaseEvent(QMouseEvent *e) + { + QSlider::mouseReleaseEvent(e); + if(e->buttons()^Qt::LeftButton) + { + double p=e->pos().x()/(double)width(); + setValue(p*(maximum()-minimum())+minimum()); + emit sliderReleased(); + } + } +}; + class qmpMainWindow:public QMainWindow { Q_OBJECT @@ -83,6 +103,7 @@ class qmpMainWindow:public QMainWindow qmpHelpWindow *helpw; QAction *fnA1,*fnA2,*fnA3; + void onfnChanged(); void playerSetup(); private: -- cgit v1.2.3