Kstars

clicklabel.h
1/*
2 SPDX-FileCopyrightText: 2005 Jason Harris <kstars@30doradus.org>
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 */
18class ClickLabel : public QLabel
19{
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
This is a QLabel with a clicked() signal.
Definition clicklabel.h:19
Q_OBJECTQ_OBJECT
QObject * parent() const const
Qt::MouseButton button() const const
LeftButton
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.