Kstars

clicklabel.h
1 /*
2  SPDX-FileCopyrightText: 2005 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef CLICKLABEL_H
8 #define CLICKLABEL_H
9 
10 #include <QLabel>
11 #include <QMouseEvent>
12 
13 /** @class ClickLabel
14  * @brief This is a QLabel with a clicked() signal.
15  *@author Jason Harris
16  *@version 1.0
17  */
18 class ClickLabel : public QLabel
19 {
20  Q_OBJECT
21  public:
22  explicit ClickLabel(QWidget *parent = nullptr, const char *name = nullptr);
23  ~ClickLabel() override = default;
24 
25  signals:
26  void clicked();
27 
28  protected:
29  void mousePressEvent(QMouseEvent *e) override
30  {
31  if (e->button() == Qt::LeftButton)
32  emit clicked();
33  }
34 };
35 
36 #endif
Q_OBJECTQ_OBJECT
Qt::MouseButton button() const const
This is a QLabel with a clicked() signal.
Definition: clicklabel.h:18
LeftButton
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Aug 14 2022 04:13:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.