blob: 37331c86304f772a100d1e80eb00e0b81a0404f0 [file] [log] [blame]
Yingdi Yu95dbc712016-03-21 09:56:57 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev37667752017-02-02 13:52:12 -08003 * Copyright (c) 2013-2017, Regents of the University of California,
Yingdi Yu95dbc712016-03-21 09:56:57 -07004 *
5 * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD
6 * authors and contributors.
7 *
8 * NFD Control Center is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with NFD
17 * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "cert-tree-model.hpp"
Yingdi Yu95dbc712016-03-21 09:56:57 -070021#include "cert-tree-model.moc"
Yingdi Yu95dbc712016-03-21 09:56:57 -070022
23namespace ndn {
24namespace ncc {
25
26CertTreeModel::CertTreeModel(int row, int column, QObject* parent)
27 : QStandardItemModel(row, column, parent)
28{
29}
30
31QVariant
32CertTreeModel::data(const QModelIndex& index, int role) const
33{
34 switch (role) {
35 case Qt::FontRole:
36 {
37 QFont font;
38 if (index.column() == 0) {
39 font.setBold(true);
40 }
41 return font;
42 }
43 case Qt::BackgroundRole:
44 {
45 QBrush brush(Qt::white, Qt::SolidPattern);
46 if (index.row() % 2 == 0) {
Yingdi Yu7268d6b2016-03-21 16:57:17 -070047 brush.setColor(QColor::fromRgb(225, 225, 225));
Yingdi Yu95dbc712016-03-21 09:56:57 -070048 }
49 return brush;
50 }
51 default:
52 return QStandardItemModel::data(index, role);
53 }
54}
55
56} // namespace ncc
57} // namespace ndn