File indexing completed on 2024-06-16 04:56:15

0001 /*  view/infofield.h
0002 
0003     This file is part of Kleopatra, the KDE keymanager
0004     SPDX-FileCopyrightText: 2022 g10 Code GmbH
0005     SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <QString>
0012 
0013 class QAction;
0014 class QHBoxLayout;
0015 class QIcon;
0016 class QLabel;
0017 class QLayout;
0018 class QPushButton;
0019 class QWidget;
0020 
0021 namespace Kleo
0022 {
0023 
0024 class InfoField
0025 {
0026 public:
0027     InfoField(const QString &label, QWidget *parent);
0028 
0029     QLabel *label() const;
0030     QLayout *layout() const;
0031 
0032     void setValue(const QString &value, const QString &accessibleValue = {});
0033     QString value() const;
0034 
0035     void setIcon(const QIcon &icon);
0036     void setAction(const QAction *action);
0037     void setToolTip(const QString &toolTip);
0038     void setVisible(bool visible);
0039 
0040 private:
0041     void onActionChanged();
0042 
0043     QLabel *mLabel = nullptr;
0044     QHBoxLayout *mLayout = nullptr;
0045     QLabel *mIcon = nullptr;
0046     QLabel *mValue = nullptr;
0047     QPushButton *mButton = nullptr;
0048     const QAction *mAction = nullptr;
0049 };
0050 
0051 }