blob: 6b4857b6a9c7a7fb85d88f7f81e9bc015b61e6c6 (
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
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "pcccustomslice.h"
PccCustomSlice::PccCustomSlice(const QString &label, qreal value)
: QPieSlice(label, value)
{
connect(this, &PccCustomSlice::hovered, this, &PccCustomSlice::showHighlight);
}
QBrush PccCustomSlice::originalBrush()
{
return m_originalBrush;
}
void PccCustomSlice::showHighlight(bool show)
{
if (show) {
QBrush brush = this->brush();
m_originalBrush = brush;
brush.setColor(brush.color().lighter());
setBrush(brush);
} else {
setBrush(m_originalBrush);
}
}
|