dde-control-center
Deepin Control Center
载入中...
搜索中...
未找到
titlevalueitem.h
1//SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
2//
3//SPDX-License-Identifier: GPL-3.0-or-later
4#pragma once
5
6#include "interface/namespace.h"
7#include "widgets/settingsitem.h"
8
9#include <DTipLabel>
10
11QT_BEGIN_NAMESPACE
12class QPushButton;
13class QLabel;
14QT_END_NAMESPACE
15
16namespace DCC_NAMESPACE
17{
18
19class ItemTitleTipsLabel;
20
21class ResizeEventFilter : public QObject
22{
23 Q_OBJECT
24public:
25 explicit ResizeEventFilter(QObject* parent = nullptr);
26protected:
27 bool eventFilter(QObject *watched, QEvent *event);
28};
29
31{
32 Q_OBJECT
33
34public:
35 explicit TitleValueItem(QFrame *parent = nullptr);
36 ~TitleValueItem() override;
37 void setTitle(const QString& title);
38 void setValue(const QString& value);
39 void setWordWrap(const bool enable);
40 QString value() const;
41 void setValueAligment(const Qt::Alignment aligment);
42 void setValueBackground(bool showBackground);
43
44protected:
45 void resizeEvent(QResizeEvent *event) override;
46
47private:
48 QLabel* m_title;
49 ItemTitleTipsLabel *m_value;
50};
51
53{
54 Q_OBJECT
55
56public:
57 TitleAuthorizedItem(QFrame *parent = nullptr);
58 void setTitle(const QString& title);
59 void setValue(const QString& value);
60 void setWordWrap(bool enable);
61 void setButtonText(const QString &str);
62 void setValueForegroundRole(const QColor &color);
63 void setVisable(bool value);
64
65Q_SIGNALS:
66 //传递button的点击信号
67 void clicked();
68
69private:
70 QLabel* m_title;
71 DTK_WIDGET_NAMESPACE::DTipLabel *m_value;
72 QPushButton *m_pActivatorBtn;
73};
74
75class ItemTitleTipsLabel : public DTK_WIDGET_NAMESPACE::DTipLabel
76{
77 Q_OBJECT
78
79public:
80 explicit ItemTitleTipsLabel(const QString &text = QString(), QWidget *parent = nullptr);
81 ~ItemTitleTipsLabel() override;
82 void addBackground();
83 void removeBackground();
84 bool hasBackground() const;
85
86protected:
87 void paintEvent(QPaintEvent *event) override;
88
89private:
90 bool m_hasBackground;
91};
92
93}
Definition titlevalueitem.h:76
Definition titlevalueitem.h:22
Definition settingsitem.h:11
Definition titlevalueitem.h:53
Definition titlevalueitem.h:31