| 33 | #include <mitkToolManagerProvider.h> |
| 34 | |
| 35 | QmitkToolSelectionBox::QmitkToolSelectionBox(QWidget *parent, mitk::DataStorage *) |
| 36 | : QWidget(parent), |
| 37 | m_SelfCall(false), |
| 38 | m_DisplayedGroups("default"), |
| 39 | m_LayoutColumns(2), |
| 40 | m_ShowNames(true), |
| 41 | m_GenerateAccelerators(false), |
| 42 | m_ToolGUIWidget(nullptr), |
| 43 | m_LastToolGUI(nullptr), |
| 44 | m_ToolButtonGroup(nullptr), |
| 45 | m_ButtonLayout(nullptr) |
| 46 | { |
| 47 | QFont currentFont = QWidget::font(); |
| 48 | currentFont.setBold(true); |
| 49 | QWidget::setFont(currentFont); |
| 50 | |
| 51 | m_ToolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager(); |
| 52 | |
| 53 | // QButtonGroup |
| 54 | m_ToolButtonGroup = new QButtonGroup(this); |
| 55 | // some features of QButtonGroup |
| 56 | m_ToolButtonGroup->setExclusive(false); // mutually exclusive toggle buttons |
| 57 | |
| 58 | RecreateButtons(); |
| 59 | |
| 60 | QWidget::setContentsMargins(0, 0, 0, 0); |
| 61 | if (layout() != nullptr) |
| 62 | { |
| 63 | layout()->setContentsMargins(0, 0, 0, 0); |
| 64 | } |
| 65 | |
| 66 | // reactions to signals |
| 67 | connect(m_ToolButtonGroup, &QButtonGroup::idClicked, this, &QmitkToolSelectionBox::toolButtonClicked); |
| 68 | |
| 69 | // reactions to ToolManager events |
| 70 | |
| 71 | m_ToolManager->ActiveToolChanged += |
| 72 | mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerToolModified); |
| 73 | m_ToolManager->ReferenceDataChanged += |
| 74 | mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerReferenceDataModified); |
| 75 | m_ToolManager->WorkingDataChanged += |
| 76 | mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerWorkingDataModified); |
| 77 | |
| 78 | // show active tool |
| 79 | SetOrUnsetButtonForActiveTool(); |
| 80 | |
| 81 | QWidget::setEnabled(false); |
| 82 | } |
| 83 | |
| 84 | QmitkToolSelectionBox::~QmitkToolSelectionBox() |
| 85 | { |
nothing calls this directly
no test coverage detected