1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #include "symboldelegate.h" |
6 | |
7 | #include <QPainter> |
8 | |
9 | class SymbolDelegatePrivate |
10 | { |
11 | friend class SymbolDelegate; |
12 | QModelIndex index; |
13 | }; |
14 | |
15 | SymbolDelegate::SymbolDelegate(QObject *parent) |
16 | : QStyledItemDelegate (parent) |
17 | , d (new SymbolDelegatePrivate) |
18 | { |
19 | |
20 | } |
21 | |
22 | void SymbolDelegate::setActiveProject(const QModelIndex &root) |
23 | { |
24 | d->index = root; |
25 | } |
26 | |
27 | void SymbolDelegate::paint(QPainter *painter, |
28 | const QStyleOptionViewItem &option, |
29 | const QModelIndex &index) const |
30 | { |
31 | QStyleOptionViewItem iOption = option; |
32 | if (d->index.isValid() && d->index == index) { |
33 | iOption.font.setBold(true); |
34 | } |
35 | QStyledItemDelegate::paint(painter, iOption, index); |
36 | } |
37 |