BibleTime
categoryitem.cpp
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #include "categoryitem.h"
14 
15 #include <QIcon>
16 #include "../drivers/cswordmoduleinfo.h"
17 
18 
19 namespace BookshelfModel {
20 
21 
22 QVariant CategoryItem::data(int role) const {
23  switch (role) {
24 
25  case Qt::DisplayRole:
27 
28  case Qt::DecorationRole:
30 
31  default:
32  return Item::data(role);
33 
34  }
35 }
36 
37 bool CategoryItem::operator<(const Item & other) const {
38  if (other.type() != ITEM_CATEGORY)
39  return ITEM_CATEGORY < other.type();
40 
41  const CategoryItem & o = static_cast<const CategoryItem &>(other);
43  return false;
45  return true;
46  return m_category < o.m_category;
47 }
48 
49 } // namespace BookshelfModel
CSwordModuleInfo::Category const m_category
Definition: categoryitem.h:42
bool operator<(const Item &other) const override
Comparsion operator used sorting child items.
QVariant data(int role=Qt::DisplayRole) const override
Returns data for this item.
virtual QVariant data(int role=Qt::DisplayRole) const
Returns data for this item.
Definition: item.cpp:44
Type type() const
Returns the type of this item.
Definition: item.h:49
static QString categoryName(const CSwordModuleInfo::Category &category)
static QIcon const & categoryIcon(CSwordModuleInfo::Category category)