TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
ttkclickedgroup.cpp
Go to the documentation of this file.
1 #include "ttkclickedgroup.h"
2 
4  : QObject(parent)
5 {
6 
7 }
8 
9 void TTKClickedGroup::mapped(QWidget *widget)
10 {
11  m_container << widget;
12  connect(widget, SIGNAL(clicked()), this, SLOT(update()));
13 }
14 
16 {
17  QWidget *widget = TTKObjectCast(QWidget*, sender());
18  if(!widget)
19  {
20  return;
21  }
22 
23  int index = -1;
24  for(int i = 0; i < m_container.count(); ++i)
25  {
26  if(m_container[i] == widget)
27  {
28  index = i;
29  break;
30  }
31  }
32 
33  if(index == -1)
34  {
35  return;
36  }
37 
38  Q_EMIT clicked(index);
39 }
void clicked(int index)
void mapped(QWidget *widget)
TTKClickedGroup(QObject *parent=nullptr)
QWidgetList m_container
#define TTKObjectCast(x, y)
Definition: ttkqtglobal.h:60