| 155 | } |
| 156 | |
| 157 | QVariant |
| 158 | MonitorDataModel::data( const QModelIndex& index, int role) const |
| 159 | { |
| 160 | if( false == index.isValid()) { |
| 161 | return QVariant(); |
| 162 | } |
| 163 | |
| 164 | switch( role) { |
| 165 | case Qt::DisplayRole: |
| 166 | return this->getNode( index)->column( index.column()); |
| 167 | |
| 168 | // for checkboxes in tree view |
| 169 | // case Qt::CheckStateRole: |
| 170 | // return Qt::Checked; |
| 171 | case Qt::ToolTipRole: |
| 172 | case Qt::StatusTipRole: |
| 173 | case Qt::WhatsThisRole: |
| 174 | default: |
| 175 | return QVariant(); |
| 176 | |
| 177 | case Qt::BackgroundRole: |
| 178 | { |
| 179 | QVariant value = this->getNode( index)->color( index.column()); |
| 180 | if( value.value<QColor>().isValid()) { |
| 181 | return value; |
| 182 | } else { |
| 183 | return QVariant(); |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | Qt::ItemFlags |
| 190 | MonitorDataModel::flags( const QModelIndex& index) const |
no test coverage detected