| 46 | } |
| 47 | |
| 48 | QVariant |
| 49 | BookmarkTableModel::data(const QModelIndex &index, int role) const |
| 50 | { |
| 51 | if (index.row() < 0 || index.row() >= this->bookmarkPtr->count()) |
| 52 | return QVariant(); |
| 53 | |
| 54 | Suscan::Bookmark bookmark = |
| 55 | (*this->bookmarkPtr)[this->bookmarkPtr->keys().at(index.row())]; |
| 56 | |
| 57 | if (role == Qt::DisplayRole) { |
| 58 | switch (index.column()) { |
| 59 | case 0: |
| 60 | return SuWidgetsHelpers::formatQuantity(bookmark.info.frequency, "Hz"); |
| 61 | |
| 62 | case 1: |
| 63 | return SuWidgetsHelpers::formatQuantity(bookmark.info.bandwidth(), "Hz"); |
| 64 | |
| 65 | case 2: |
| 66 | return bookmark.info.modulation; |
| 67 | |
| 68 | case 3: |
| 69 | return ""; |
| 70 | |
| 71 | case 4: |
| 72 | return bookmark.info.name; |
| 73 | |
| 74 | case 5: |
| 75 | case 6: |
| 76 | return QVariant(); |
| 77 | } |
| 78 | } else if (role == Qt::BackgroundColorRole) { |
| 79 | if (index.column() == 3) |
| 80 | return bookmark.info.color; |
| 81 | } |
| 82 | |
| 83 | return QVariant(); |
| 84 | } |
| 85 | |
| 86 | QVariant |
| 87 | BookmarkTableModel::headerData(int s, Qt::Orientation hor, int role) const |