Skip to content

Commit

Permalink
Validate the Modelica text when toolbar button is pressed (#7431)
Browse files Browse the repository at this point in the history
Fixes #7389
  • Loading branch information
adeas31 committed May 3, 2021
1 parent 0976f4e commit 81c86f0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -7855,6 +7855,7 @@ bool ModelWidgetContainer::eventFilter(QObject *object, QEvent *event)
* If MainWindow shortcut for menu actions are used then we should try to validate text since we can create a new model from there.
* If context menu is used on LibraryTreeView to save a model other than the current model.
* If QMenuBar is used with mouse or keyboard/shortcut
* If QToolBar QToolButton is used with mouse. See issue #7389.
* If users switches between model using the tab bar.
* If focus in called for DocumentationViewer
*/
Expand All @@ -7871,6 +7872,7 @@ bool ModelWidgetContainer::eventFilter(QObject *object, QEvent *event)
} else if (event->type() == QEvent::ContextMenu && object->parent() && qobject_cast<LibraryTreeView*>(object->parent())) {
shouldValidateText = true;
} else if ((event->type() == QEvent::MouseButtonPress && qobject_cast<QMenuBar*>(object)) ||
(event->type() == QEvent::MouseButtonPress && qobject_cast<QToolButton*>(object)) ||
(event->type() == QEvent::Shortcut && qobject_cast<QMenuBar*>(object)) ||
(event->type() == QEvent::MouseButtonPress && qobject_cast<QTabBar*>(object)) ||
(event->type() == QEvent::FocusIn && qobject_cast<DocumentationViewer*>(object))) {
Expand Down

0 comments on commit 81c86f0

Please sign in to comment.