Page MenuHomePhabricator

ImageStatistics plugin takes focus from DataManager
Closed, ResolvedPublic

Description

If two or more imagas are loaded while the plugin is active, the focus is always in the ImageStatistics plugin (due to a repaint?)

I did the following:

  • open two arbitrary images
  • open the imageStatistics plugin
  • select one node, the statistics are calculated
  • I select both image nodes and press del to delete the images. Nothing happens because the plugin steals the focus from the DataManager.
  • closing the plugin leads to the desired behaviour, I can delete both images with keyboard interaction again.

I tested in with MITK 2016.11 Release in Windows

BTW: In the help window of the plugin, MITK Measurement is the title. And the Troubleshooting section could be removed as it is empty.

Event Timeline

kislinsk triaged this task as Normal priority.Mar 7 2017, 10:54 AM

issue still exists in the current master.

hentsch added a project: Restricted Project.

focus stealing caused by call of line 484 in QmitkStatisticsView.cpp (groupBox->setEnabled(true)):

else
{
  m_Controls->groupBox->setEnabled(true);
  m_Controls->groupBox_3->setEnabled(true);
  m_Controls->m_barRadioButton->setChecked(true);
}

has something to do with the QmitkChartWidget. The focus stealing does not takes place if the widget is not enabled.

Tracked it down. Origin of the problem is in QmitkChartWidget:

m_WebEngineView->setUrl(QUrl(QStringLiteral("qrc:///C3js/empty.html")));

Has something to do with WebEngineView of Qt.

Found the solution:
https://stackoverflow.com/questions/36609489/how-to-prevent-qwebengineview-to-grab-focus-on-sethtml-and-load-calls

webView->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);

drawback: we need Qt 5.8. Wait until Minimum version is 5.8 (currently 5.6)