Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Alexander Afanasyev | 3766775 | 2017-02-02 13:52:12 -0800 | [diff] [blame^] | 3 | * Copyright (c) 2013-2017, Regents of the University of California, |
Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 4 | * |
| 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 Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 21 | #include "cert-tree-model.moc" |
Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 22 | |
| 23 | namespace ndn { |
| 24 | namespace ncc { |
| 25 | |
| 26 | CertTreeModel::CertTreeModel(int row, int column, QObject* parent) |
| 27 | : QStandardItemModel(row, column, parent) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | QVariant |
| 32 | CertTreeModel::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 Yu | 7268d6b | 2016-03-21 16:57:17 -0700 | [diff] [blame] | 47 | brush.setColor(QColor::fromRgb(225, 225, 225)); |
Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 48 | } |
| 49 | return brush; |
| 50 | } |
| 51 | default: |
| 52 | return QStandardItemModel::data(index, role); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | } // namespace ncc |
| 57 | } // namespace ndn |