mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
ClickableFrame is in widgets
This commit is contained in:
parent
315eec99ba
commit
8124eed5f7
2 changed files with 25 additions and 23 deletions
|
|
@ -5,28 +5,7 @@ except Exception:
|
|||
|
||||
from Qt import QtWidgets, QtCore, QtGui
|
||||
|
||||
|
||||
class _ClickableFrame(QtWidgets.QFrame):
|
||||
def __init__(self, parent):
|
||||
super(_ClickableFrame, self).__init__(parent)
|
||||
|
||||
self._mouse_pressed = False
|
||||
|
||||
def _mouse_release_callback(self):
|
||||
pass
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
if event.button() == QtCore.Qt.LeftButton:
|
||||
self._mouse_pressed = True
|
||||
super(_ClickableFrame, self).mousePressEvent(event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
if self._mouse_pressed:
|
||||
self._mouse_pressed = False
|
||||
if self.rect().contains(event.pos()):
|
||||
self._mouse_release_callback()
|
||||
|
||||
super(_ClickableFrame, self).mouseReleaseEvent(event)
|
||||
from .widgets import ClickableFrame
|
||||
|
||||
|
||||
class ValidationErrorInstanceList(QtWidgets.QListView):
|
||||
|
|
@ -60,7 +39,7 @@ class ValidationErrorTitleWidget(QtWidgets.QWidget):
|
|||
self._error_info = error_info
|
||||
self._selected = False
|
||||
|
||||
title_frame = _ClickableFrame(self)
|
||||
title_frame = ClickableFrame(self)
|
||||
title_frame.setObjectName("ValidationErrorTitleFrame")
|
||||
title_frame._mouse_release_callback = self._mouse_release_callback
|
||||
|
||||
|
|
|
|||
|
|
@ -148,6 +148,29 @@ class AbstractInstanceView(QtWidgets.QWidget):
|
|||
).format(self.__class__.__name__))
|
||||
|
||||
|
||||
class ClickableFrame(QtWidgets.QFrame):
|
||||
def __init__(self, parent):
|
||||
super(ClickableFrame, self).__init__(parent)
|
||||
|
||||
self._mouse_pressed = False
|
||||
|
||||
def _mouse_release_callback(self):
|
||||
pass
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
if event.button() == QtCore.Qt.LeftButton:
|
||||
self._mouse_pressed = True
|
||||
super(ClickableFrame, self).mousePressEvent(event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
if self._mouse_pressed:
|
||||
self._mouse_pressed = False
|
||||
if self.rect().contains(event.pos()):
|
||||
self._mouse_release_callback()
|
||||
|
||||
super(ClickableFrame, self).mouseReleaseEvent(event)
|
||||
|
||||
|
||||
class ContextWarningLabel(QtWidgets.QLabel):
|
||||
cached_images_by_size = {}
|
||||
source_image = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue