TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicmovingclickedslider.cpp
Go to the documentation of this file.
2 
3 #include <QMouseEvent>
4 
6  : MusicMovingClickedSlider(Qt::Horizontal, parent)
7 {
8 
9 }
10 
11 MusicMovingClickedSlider::MusicMovingClickedSlider(Qt::Orientation orientation, QWidget *parent)
12  : TTKClickedSlider(orientation, parent),
13  m_isMoving(false)
14 {
15  setMouseTracking(true);
16 }
17 
19 {
20  if(!m_isMoving)
21  {
22  TTKClickedSlider::setValue(value);
23  }
24 }
25 
27 {
29  if(event->button() == Qt::LeftButton)
30  {
31  m_isMoving = false;
32  Q_EMIT sliderMoved(m_value);
33  }
34 }
35 
37 {
39  if(m_mousePress)
40  {
41  m_isMoving = true;
42  Q_EMIT sliderMoved(m_value);
43  }
44 }
45 
47 {
49  if(event->button() == Qt::LeftButton)
50  {
51  Q_EMIT sliderReleasedAt(m_value);
52  m_isMoving = false;
53  }
54 }
virtual void mouseReleaseEvent(QMouseEvent *event) override
virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mouseMoveEvent(QMouseEvent *event) override
The class of the slider that can clicked any position.
MusicMovingClickedSlider(QWidget *parent=nullptr)
virtual void mousePressEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
void sliderReleasedAt(int pos)
The class of the slider moving clicked slider.
virtual void mouseReleaseEvent(QMouseEvent *event) override