| 1 |
/* |
| 2 |
* Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd. |
| 3 |
* |
| 4 |
* Author: ZhangYong <[email protected]> |
| 5 |
* |
| 6 |
* Maintainer: ZhangYong <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
#include "dfmdarrowlineexpand.h" |
| 22 |
|
| 23 |
#include <DFontSizeManager> |
| 24 |
#include <DApplicationHelper> |
| 25 |
#include <QPainter> |
| 26 |
#include <QPainterPath> |
| 27 |
|
| 28 |
DFMDArrowLineExpand::DFMDArrowLineExpand() |
| 29 |
{ |
| 30 |
// if (headerLine()) { |
| 31 |
// DFontSizeManager::instance()->bind(headerLine(), DFontSizeManager::T6); |
| 32 |
|
| 33 |
// DPalette pa = DApplicationHelper::instance()->palette(headerLine()); |
| 34 |
// pa.setBrush(DPalette::Text, pa.color(DPalette::TextTitle)); |
| 35 |
// headerLine()->setPalette(pa); |
| 36 |
// connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, [ = ] { |
| 37 |
// DPalette pa = DApplicationHelper::instance()->palette(headerLine()); |
| 38 |
// pa.setBrush(DPalette::Text, pa.color(DPalette::TextTitle)); |
| 39 |
// headerLine()->setPalette(pa); |
| 40 |
// }); |
| 41 |
|
| 42 |
// headerLine()->setLeftMargin(10); |
| 43 |
// } |
| 44 |
} |
| 45 |
|
| 46 |
void DFMDArrowLineExpand::paintEvent(QPaintEvent *event) |
| 47 |
{ |
| 48 |
Q_UNUSED(event); |
| 49 |
QPainter painter(this); |
| 50 |
QRectF bgRect; |
| 51 |
bgRect.setSize(size()); |
| 52 |
const QPalette pal = QGuiApplication::palette();//this->palette(); |
| 53 |
QColor bgColor = pal.color(QPalette::Background); |
| 54 |
|
| 55 |
QPainterPath path; |
| 56 |
path.addRoundedRect(bgRect, 8, 8); |
| 57 |
painter.setRenderHint(QPainter::Antialiasing, true); |
| 58 |
painter.fillPath(path, bgColor); |
| 59 |
painter.setRenderHint(QPainter::Antialiasing, false); |
| 60 |
} |