Baloo Widgets

tagcheckbox.h
1 /*
2  SPDX-FileCopyrightText: 2010 Sebastian Trueg <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef _BALOO_TAG_CHECKBOX_H_
8 #define _BALOO_TAG_CHECKBOX_H_
9 
10 #include <QWidget>
11 
12 #include "tagwidget_p.h"
13 
14 class QMouseEvent;
15 class QLabel;
16 
17 namespace Baloo
18 {
19 class TagCheckBox : public QWidget
20 {
21  Q_OBJECT
22 
23 public:
24  explicit TagCheckBox(const QString &tag, QWidget *parent = nullptr);
25  ~TagCheckBox() override;
26 
27  QString tag() const
28  {
29  return m_tag;
30  }
31 
32 Q_SIGNALS:
33  void tagClicked(const QString &tag);
34 
35 protected:
36  void leaveEvent(QEvent *event) override;
37  bool eventFilter(QObject *watched, QEvent *event) override;
38 
39 private:
40  QRect tagRect() const;
41  void enableUrlHover(bool enabled);
42 
43  // two modes: checkbox and simple label
44  QLabel *m_label = nullptr;
45  QWidget *m_child = nullptr;
46 
47  QString m_tag;
48  bool m_urlHover = false;
49 };
50 }
51 
52 #endif
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 11 2022 04:13:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.