File indexing completed on 2024-12-01 04:36:50

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_export.h"
0010 #include <QLabel>
0011 #include <QWidget>
0012 
0013 class LIBRUQOLAWIDGETS_EXPORT ClickableLabel : public QLabel
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit ClickableLabel(QWidget *parent = nullptr);
0018     ~ClickableLabel() override;
0019 
0020 Q_SIGNALS:
0021     void clicked();
0022 
0023 protected:
0024     void mousePressEvent(QMouseEvent *event) override;
0025 };
0026 
0027 class LIBRUQOLAWIDGETS_EXPORT ClickableWidget : public QWidget
0028 {
0029     Q_OBJECT
0030 public:
0031     explicit ClickableWidget(const QString &userName, QWidget *parent = nullptr);
0032     ~ClickableWidget() override;
0033 
0034     [[nodiscard]] QString name() const;
0035     void setName(const QString &userName);
0036 
0037     [[nodiscard]] QString identifier() const;
0038     void setIdentifier(const QString &userId);
0039 
0040 Q_SIGNALS:
0041     void removeClickableWidget(const QString &username);
0042 
0043 private:
0044     LIBRUQOLAWIDGETS_NO_EXPORT void slotRemove();
0045     QString mName;
0046     QString mIdentifier;
0047     QLabel *const mLabel;
0048     ClickableLabel *const mClickableLabel;
0049 };