TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
ttkclickedgroup.h
Go to the documentation of this file.
1 #ifndef TTKCLICKEDGROUP_H
2 #define TTKCLICKEDGROUP_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Library Module project
6  * Copyright (C) 2015 - 2026 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17 
18  * You should have received a copy of the GNU Lesser General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include <QWidget>
23 #include "ttkmoduleexport.h"
24 
28 class TTK_MODULE_EXPORT TTKClickedGroup : public QObject
29 {
30  Q_OBJECT
31 public:
35  explicit TTKClickedGroup(QObject *parent = nullptr);
36 
40  void addWidget(QWidget *widget, int id = -1);
44  void removeWidget(QWidget *widget);
45 
49  QList<QWidget*> items() const;
53  QWidget *widget(int id) const;
54 
58  void setId(QWidget *widget, int id);
62  int id(QWidget *widget) const;
63 
64 Q_SIGNALS:
68  void clicked(int index);
69 
70 private Q_SLOTS:
74  void update();
75 
76 private:
77  struct Data
78  {
79  int m_id;
80  QWidget *m_widget;
81 
82  inline bool operator ==(const Data &other) const noexcept
83  {
84  return m_widget == other.m_widget;
85  }
86  };
87 
88  QList<Data> m_container;
89 
90 };
91 
92 #endif // TTKCLICKEDGROUP_H
#define TTK_MODULE_EXPORT
bool operator==(const TTKOptional< T > &v, const T &other)
Definition: ttkoptional.h:144
QList< Data > m_container
The class of the label widget click group mapper.