void InstrumentWidgetMaskTab::showEvent(QShowEvent *) {
  setActivity();
  m_instrWidget->setMouseTracking(true);
  enableApplyButtons();
  m_instrWidget->updateInstrumentView(true);
  m_instrWidget->getSurface()->changeBorderColor(getShapeBorderColor());
}
/**
  * Set tab's activity based on the currently selected tool button.
  */
void InstrumentWindowMaskTab::setActivity()
{
  const QColor borderColor = getShapeBorderColor();
  const QColor fillColor = getShapeFillColor();
  if (m_move->isChecked())
  {
    m_activity = Move;
    m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::MoveMode);
    m_activeTool->setText("Tool: Navigation");
  }
  else if (m_pointer->isChecked())
  {
    m_activity = Select;
    m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
    m_activeTool->setText("Tool: Shape editing");
  }
  else if (m_ellipse->isChecked())
  {
    m_activity = DrawEllipse;
    m_instrWindow->getSurface()->startCreatingShape2D("ellipse",borderColor,fillColor);
    m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
    m_activeTool->setText("Tool: Ellipse");
  }
  else if (m_rectangle->isChecked())
  {
    m_activity = DrawRectangle;
    m_instrWindow->getSurface()->startCreatingShape2D("rectangle",borderColor,fillColor);
    m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
    m_activeTool->setText("Tool: Rectangle");
  }
  else if (m_ring_ellipse->isChecked())
  {
    m_activity = DrawEllipticalRing;
    m_instrWindow->getSurface()->startCreatingShape2D("ring ellipse",borderColor,fillColor);
    m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
    m_activeTool->setText("Tool: Elliptical ring");
  }
  else if (m_ring_rectangle->isChecked())
  {
    m_activity = DrawRectangularRing;
    m_instrWindow->getSurface()->startCreatingShape2D("ring rectangle",borderColor,fillColor);
    m_instrWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
    m_activeTool->setText("Tool: Rectangular ring");
  }
  m_instrWindow->updateInfoText();
}