Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2013-2014, Regents of the University of California, |
| 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" |
| 21 | |
| 22 | #ifdef WAF |
| 23 | #include "cert-tree-model.moc" |
| 24 | #endif |
| 25 | |
| 26 | namespace ndn { |
| 27 | namespace ncc { |
| 28 | |
| 29 | CertTreeModel::CertTreeModel(int row, int column, QObject* parent) |
| 30 | : QStandardItemModel(row, column, parent) |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | QVariant |
| 35 | CertTreeModel::data(const QModelIndex& index, int role) const |
| 36 | { |
| 37 | switch (role) { |
| 38 | case Qt::FontRole: |
| 39 | { |
| 40 | QFont font; |
| 41 | if (index.column() == 0) { |
| 42 | font.setBold(true); |
| 43 | } |
| 44 | return font; |
| 45 | } |
| 46 | case Qt::BackgroundRole: |
| 47 | { |
| 48 | QBrush brush(Qt::white, Qt::SolidPattern); |
| 49 | if (index.row() % 2 == 0) { |
| 50 | brush.setColor(Qt::lightGray); |
| 51 | } |
| 52 | return brush; |
| 53 | } |
| 54 | default: |
| 55 | return QStandardItemModel::data(index, role); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | } // namespace ncc |
| 60 | } // namespace ndn |