| 39 | } |
| 40 | |
| 41 | QVariant T_IconModel::data(const QModelIndex& index, int role) const |
| 42 | { |
| 43 | if (role == Qt::UserRole) |
| 44 | { |
| 45 | if (!_pIsSearchMode) |
| 46 | { |
| 47 | if (index.row() >= _metaEnum.keyCount() - 1) |
| 48 | { |
| 49 | return QVariant(); |
| 50 | } |
| 51 | return QStringList{_metaEnum.key(index.row() + 1), QChar(_metaEnum.value(index.row() + 1))}; |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | QStringList iconList; |
| 56 | if (index.row() >= _searchKeyList.count()) |
| 57 | { |
| 58 | return QVariant(); |
| 59 | } |
| 60 | iconList.append(_searchKeyList.at(index.row())); |
| 61 | iconList.append(QChar(_metaEnum.keyToValue(_searchKeyList.at(index.row()).toUtf8().constData()))); |
| 62 | return iconList; |
| 63 | } |
| 64 | } |
| 65 | return QVariant(); |
| 66 | } |
| 67 | |
| 68 | QString T_IconModel::getIconNameFromModelIndex(const QModelIndex& index) const |
| 69 | { |