| 253 | } |
| 254 | |
| 255 | void AnnotationDisplay::setAnnotationObject(const SDObject *annotation) |
| 256 | { |
| 257 | m_Tree->updateExpansion(m_Expansion, 0); |
| 258 | |
| 259 | m_Annotation = annotation; |
| 260 | |
| 261 | m_Items.clear(); |
| 262 | m_Tree->invisibleRootItem()->clear(); |
| 263 | |
| 264 | // Check if we have any buffer annotations to determine columns |
| 265 | m_HasGoColumn = m_Annotation && hasResourceAnnotations(*m_Annotation); |
| 266 | |
| 267 | if(m_HasGoColumn) |
| 268 | { |
| 269 | m_Tree->setColumns({lit("Key"), tr("Value"), tr("Go")}); |
| 270 | m_Header->setSectionResizeMode(0, QHeaderView::ResizeToContents); |
| 271 | m_Header->setSectionResizeMode(1, QHeaderView::Stretch); |
| 272 | m_Header->setSectionResizeMode(2, QHeaderView::Fixed); |
| 273 | m_Header->resizeSection(2, 16); |
| 274 | } |
| 275 | else |
| 276 | { |
| 277 | m_Tree->setColumns({lit("Key"), tr("Value")}); |
| 278 | m_Header->setSectionResizeMode(0, QHeaderView::ResizeToContents); |
| 279 | m_Header->setSectionResizeMode(1, QHeaderView::Stretch); |
| 280 | } |
| 281 | |
| 282 | if(m_Annotation) |
| 283 | { |
| 284 | m_Tree->beginUpdate(); |
| 285 | addStructuredChildren(m_Tree->invisibleRootItem(), *m_Annotation); |
| 286 | m_Tree->endUpdate(); |
| 287 | } |
| 288 | |
| 289 | m_Tree->applyExpansion(m_Expansion, 0); |
| 290 | } |
| 291 | |
| 292 | void AnnotationDisplay::customContextMenu(QModelIndex index, QMenu *menu) |
| 293 | { |