Baloo Widgets

tagcheckbox.h
1 /*
2  This file is part of the Baloo KDE project.
3  Copyright (C) 2010 Sebastian Trueg <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library 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 GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef _BALOO_TAG_CHECKBOX_H_
23 #define _BALOO_TAG_CHECKBOX_H_
24 
25 #include <QWidget>
26 
27 #include "tagwidget_p.h"
28 
29 class QMouseEvent;
30 class QLabel;
31 
32 namespace Baloo {
33 
34 class TagCheckBox : public QWidget
35 {
36  Q_OBJECT
37 
38 public:
39  explicit TagCheckBox(const QString& tag, QWidget* parent = nullptr);
40  ~TagCheckBox() override;
41 
42  QString tag() const { return m_tag; }
43 
44 Q_SIGNALS:
45  void tagClicked(const QString& tag);
46 
47 protected:
48  void leaveEvent(QEvent* event ) override;
49  bool eventFilter(QObject* watched, QEvent* event) override;
50 
51 private:
52  QRect tagRect() const;
53  void enableUrlHover( bool enabled );
54 
55  // two modes: checkbox and simple label
56  QLabel* m_label;
57  QWidget* m_child;
58 
59  QString m_tag;
60  bool m_urlHover;
61 };
62 }
63 
64 #endif
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 23:07:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.