| 257 | } |
| 258 | |
| 259 | void QmitkNodeSelectionDialog::AddPanel(const mitk::IDataStorageInspectorProvider * provider, const mitk::IDataStorageInspectorProvider::InspectorIDType& preferredID, bool &preferredFound, int &preferredIndex) |
| 260 | { |
| 261 | auto inspector = provider->CreateInspector(); |
| 262 | QString name = QString::fromStdString(provider->GetInspectorDisplayName()); |
| 263 | QString desc = QString::fromStdString(provider->GetInspectorDescription()); |
| 264 | |
| 265 | inspector->setParent(this); |
| 266 | inspector->SetSelectionMode(m_SelectionMode); |
| 267 | |
| 268 | auto tabPanel = new QWidget(); |
| 269 | tabPanel->setObjectName(QString("tab_") + name); |
| 270 | tabPanel->setToolTip(desc); |
| 271 | |
| 272 | auto verticalLayout = new QVBoxLayout(tabPanel); |
| 273 | verticalLayout->setSpacing(0); |
| 274 | verticalLayout->setContentsMargins(0, 0, 0, 0); |
| 275 | verticalLayout->addWidget(inspector); |
| 276 | |
| 277 | auto panelPos = m_Controls->tabWidget->insertTab(m_Controls->tabWidget->count(), tabPanel, name); |
| 278 | |
| 279 | auto icon = provider->GetInspectorIcon(); |
| 280 | if (!icon.isNull()) |
| 281 | { |
| 282 | m_Controls->tabWidget->setTabIcon(panelPos, icon); |
| 283 | } |
| 284 | |
| 285 | m_Panels.push_back(inspector); |
| 286 | connect(inspector, &QmitkAbstractDataStorageInspector::CurrentSelectionChanged, this, &QmitkNodeSelectionDialog::OnSelectionChanged); |
| 287 | connect(inspector->GetView(), &QAbstractItemView::doubleClicked, this, &QmitkNodeSelectionDialog::OnDoubleClicked); |
| 288 | |
| 289 | preferredFound = preferredFound || provider->GetInspectorID() == preferredID; |
| 290 | if (!preferredFound) |
| 291 | { |
| 292 | ++preferredIndex; |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | void QmitkNodeSelectionDialog::OnDoubleClicked(const QModelIndex& /*index*/) |
| 297 | { |
no test coverage detected