blob: b83094451e952cb183d7fdf40ff057eb823cbe57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "utils_global.h"
#include <QWidget>
namespace Utils {
class DetailsWidgetPrivate;
class FadingPanel;
class QTCREATOR_UTILS_EXPORT DetailsWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(QString summaryText READ summaryText WRITE setSummaryText DESIGNABLE true)
Q_PROPERTY(QString additionalSummaryText READ additionalSummaryText WRITE setAdditionalSummaryText DESIGNABLE true)
Q_PROPERTY(bool useCheckBox READ useCheckBox WRITE setUseCheckBox DESIGNABLE true)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE true)
Q_PROPERTY(State state READ state WRITE setState)
public:
enum State {
Expanded,
Collapsed,
NoSummary,
OnlySummary
};
Q_ENUM(State)
explicit DetailsWidget(QWidget *parent = nullptr);
~DetailsWidget() override;
void setSummaryText(const QString &text);
QString summaryText() const;
void setAdditionalSummaryText(const QString &text);
QString additionalSummaryText() const;
void setState(State state);
State state() const;
void setWidget(QWidget *widget);
QWidget *widget() const;
QWidget *takeWidget();
void setToolWidget(FadingPanel *widget);
QWidget *toolWidget() const;
void setSummaryFontBold(bool b);
bool isChecked() const;
void setChecked(bool b);
bool useCheckBox();
void setUseCheckBox(bool b);
void setCheckable(bool b);
void setExpandable(bool b);
void setIcon(const QIcon &icon);
static QPixmap createBackground(const QSize &size, int topHeight, QWidget *widget);
signals:
void checked(bool);
void linkActivated(const QString &link);
void expanded(bool);
private:
void setExpanded(bool);
protected:
void paintEvent(QPaintEvent *paintEvent) override;
void enterEvent(QEnterEvent *event) override;
void leaveEvent(QEvent *event) override;
private:
DetailsWidgetPrivate *d;
};
} // namespace Utils
|