Skip to content

Commit

Permalink
Merge pull request #3821 from ales-erjavec/fixes/mouse-press-no-basic…
Browse files Browse the repository at this point in the history
…-layout

[FIX] OWWidget: Fix an error on mouse press when widget has no basic layout
  • Loading branch information
markotoplak authored May 28, 2019
2 parents d3b9255 + 8d74a70 commit a733b89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Orange/widgets/tests/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

from unittest.mock import patch, MagicMock

from AnyQt.QtCore import QRect, QByteArray, QObject, pyqtSignal
from AnyQt.QtCore import Qt, QPoint, QRect, QByteArray, QObject, pyqtSignal
from AnyQt.QtGui import QShowEvent
from AnyQt.QtWidgets import QAction
from AnyQt.QtTest import QSignalSpy
from AnyQt.QtTest import QSignalSpy, QTest

from Orange.widgets.gui import OWComponent
from Orange.widgets.settings import Setting, SettingProvider
Expand Down Expand Up @@ -92,6 +92,7 @@ class TestWidget2(OWWidget):

w = TestWidget2()
w.showEvent(QShowEvent())
QTest.mousePress(w, Qt.LeftButton, Qt.NoModifier, QPoint(1, 1))

def test_store_restore_layout_geom(self):
class Widget(OWWidget):
Expand Down
3 changes: 2 additions & 1 deletion Orange/widgets/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,8 @@ def closeEvent(self, event):

def mousePressEvent(self, event):
""" Flash message bar icon on mouse press """
self.message_bar.flashIcon()
if self.message_bar is not None:
self.message_bar.flashIcon()
event.ignore()

def setVisible(self, visible):
Expand Down

0 comments on commit a733b89

Please sign in to comment.