File indexing completed on 2025-04-27 06:43:06
0001 /* 0002 SPDX-FileCopyrightText: 2005 Jason Harris <kstars@30doradus.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CLICKLABEL_H 0008 #define CLICKLABEL_H 0009 0010 #include <QLabel> 0011 #include <QMouseEvent> 0012 0013 /** @class ClickLabel 0014 * @brief This is a QLabel with a clicked() signal. 0015 *@author Jason Harris 0016 *@version 1.0 0017 */ 0018 class ClickLabel : public QLabel 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit ClickLabel(QWidget *parent = nullptr, const char *name = nullptr); 0023 ~ClickLabel() override = default; 0024 0025 signals: 0026 void clicked(); 0027 0028 protected: 0029 void mousePressEvent(QMouseEvent *e) override 0030 { 0031 if (e->button() == Qt::LeftButton) 0032 emit clicked(); 0033 } 0034 }; 0035 0036 #endif