2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2014-09-03 17:58:08 +02:00
|
|
|
*
|
2020-08-20 22:42:19 +02:00
|
|
|
* SPDX-FileCopyrightText: 2014 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-09-03 17:58:08 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2014-09-03 17:58:08 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-05-18 10:32:25 +02:00
|
|
|
#ifndef LIBCALAMARESUI_CLICKABLELABEL_H
|
|
|
|
#define LIBCALAMARESUI_CLICKABLELABEL_H
|
2014-09-03 17:58:08 +02:00
|
|
|
|
2020-05-18 10:32:25 +02:00
|
|
|
#include <QElapsedTimer>
|
2020-05-18 10:53:23 +02:00
|
|
|
#include <QLabel>
|
|
|
|
|
|
|
|
#include "DllMacro.h"
|
|
|
|
|
|
|
|
namespace Calamares
|
|
|
|
{
|
2014-09-03 17:58:08 +02:00
|
|
|
|
2020-05-18 10:32:25 +02:00
|
|
|
/** @brief A Label where the whole label area is clickable
|
|
|
|
*
|
|
|
|
* When clicking anywhere on the Label (text, background, whatever)
|
|
|
|
* the signal clicked() is emitted. Use this as a buddy for radio
|
|
|
|
* buttons or other clickable things where you want mouse interaction
|
|
|
|
* with the label, to be the same as mouse interaction with the control.
|
|
|
|
*/
|
2020-05-18 10:53:23 +02:00
|
|
|
class UIDLLEXPORT ClickableLabel : public QLabel
|
2014-09-03 17:58:08 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-09-26 11:51:11 +02:00
|
|
|
explicit ClickableLabel( QWidget* parent = nullptr );
|
|
|
|
explicit ClickableLabel( const QString& text, QWidget* parent = nullptr );
|
2017-09-13 18:35:56 +02:00
|
|
|
virtual ~ClickableLabel() override;
|
2014-09-03 17:58:08 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void clicked();
|
|
|
|
|
|
|
|
protected:
|
2017-09-13 18:35:56 +02:00
|
|
|
virtual void mousePressEvent( QMouseEvent* event ) override;
|
|
|
|
virtual void mouseReleaseEvent( QMouseEvent* event ) override;
|
2014-09-03 17:58:08 +02:00
|
|
|
|
|
|
|
private:
|
2020-05-18 10:32:25 +02:00
|
|
|
QElapsedTimer m_time;
|
2014-09-03 17:58:08 +02:00
|
|
|
};
|
|
|
|
|
2020-05-18 10:53:23 +02:00
|
|
|
} // namespace Calamares
|
|
|
|
|
2020-05-18 10:32:25 +02:00
|
|
|
#endif // LIBCALAMARESUI_CLICKABLELABEL_H
|