Debian Codegraph @

kysdk-qtwidgets/src/ktablemodel.cpp

raw
1 /*
2 * libkysdk-qtwidgets's Library
3 *
4 * Copyright (C) 2023, KylinSoft Co., Ltd.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this library. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Authors: Zhenyu Wang <[email protected]>
20 *
21 */
22
23 #include "ktablemodel.h"
24 #include "themeController.h"
25 #include <QApplication>
26 #include <QCheckBox>
27 #include <QDebug>
28 #include <QStyleOptionButton>
29
30 namespace kdk
31 {
32
33 class Q_DECL_HIDDEN KTableModelPrivate : public QObject, public ThemeController
34 {
35 Q_OBJECT
36 Q_DECLARE_PUBLIC(KTableModel)
37 public:
38 KTableModelPrivate(KTableModel *parent);
39
40 void changeTheme();
41
42 private:
43 KTableModel *q_ptr;
44 };
45
46 KTableModel::KTableModel(QObject *parent)
47 : QStandardItemModel(parent)
48 , d_ptr(new KTableModelPrivate(this))
49 {
50 }
51
52 QVariant KTableModel::headerData(int section, Qt::Orientation orientation, int role) const
53 {
54 (void)section;
55
56 if (orientation == Qt::Horizontal && role == Qt::TextAlignmentRole) {
57 return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
58 }
59
60 return QVariant();
61 }
62
63 KTableModelPrivate::KTableModelPrivate(KTableModel *parent)
64 : q_ptr(parent)
65 {
66 }
67
68 void KTableModelPrivate::changeTheme()
69 {
70 Q_Q(KTableModel);
71 initThemeStyle();
72 }
73
74 }
75
76 #include "ktablemodel.moc"
77 #include "moc_ktablemodel.cpp"