| 36 | } |
| 37 | |
| 38 | QVariant SessionModel::data(const QModelIndex &index, int role) const |
| 39 | { |
| 40 | if (!index.isValid()) |
| 41 | return {}; |
| 42 | |
| 43 | const auto &sessionName = sessionList.at(index.row()); |
| 44 | switch (role) { |
| 45 | case Qt::ToolTipRole: |
| 46 | case Qt::DisplayRole: |
| 47 | switch (index.column()) { |
| 48 | case 0: |
| 49 | return sessionName; |
| 50 | case 1: |
| 51 | return SessionManager::instance()->sessionDateTime(sessionName); |
| 52 | } |
| 53 | break; |
| 54 | case Qt::FontRole: { |
| 55 | auto instance = SessionManager::instance(); |
| 56 | QFont font; |
| 57 | font.setItalic(instance->isDefaultSession(sessionName)); |
| 58 | if (instance->currentSession() == sessionName && !instance->isDefaultVirgin()) |
| 59 | font.setBold(true); |
| 60 | else |
| 61 | font.setBold(false); |
| 62 | return font; |
| 63 | } |
| 64 | default: |
| 65 | break; |
| 66 | } |
| 67 | return {}; |
| 68 | } |
| 69 | |
| 70 | QVariant SessionModel::headerData(int section, Qt::Orientation orientation, int role) const |
| 71 | { |
nothing calls this directly
no test coverage detected