mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
Fix: Move Window shortcut not working on empty scene
This commit is contained in:
parent
d6b7fd7a6b
commit
050451a378
4 changed files with 50 additions and 23 deletions
|
|
@ -21,6 +21,8 @@ Fixed
|
|||
|
||||
* Fixed a bug where the binary data of deleted images would still hang
|
||||
around in the bee file.
|
||||
* Fixed: The shortcut to move the BeeRef window (Ctrl + Alt + Drag)
|
||||
not working on an empty scene
|
||||
|
||||
|
||||
0.3.0 - 2023-11-23
|
||||
|
|
|
|||
|
|
@ -33,12 +33,14 @@ class MainControlsMixin:
|
|||
* Dropping files
|
||||
"""
|
||||
|
||||
def init_main_controls(self):
|
||||
def init_main_controls(self, main_window):
|
||||
self.main_window = main_window
|
||||
self.setContextMenuPolicy(
|
||||
Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.customContextMenuRequested.connect(
|
||||
self.control_target.on_context_menu)
|
||||
self.setAcceptDrops(True)
|
||||
self.movewin_active = False
|
||||
|
||||
def dragEnterEvent(self, event):
|
||||
mimedata = event.mimeData()
|
||||
|
|
@ -76,3 +78,28 @@ class MainControlsMixin:
|
|||
commands.InsertItems(self.control_target.scene, [item], pos))
|
||||
else:
|
||||
logger.info('Drop not an image')
|
||||
|
||||
def mousePressEventMainControls(self, event):
|
||||
if (event.button() == Qt.MouseButton.LeftButton
|
||||
and event.modifiers() == (Qt.KeyboardModifier.ControlModifier
|
||||
| Qt.KeyboardModifier.AltModifier)):
|
||||
self.movewin_active = True
|
||||
self.event_start = self.mapToGlobal(event.position())
|
||||
event.accept()
|
||||
return True
|
||||
|
||||
def mouseMoveEventMainControls(self, event):
|
||||
if self.movewin_active:
|
||||
pos = self.mapToGlobal(event.position())
|
||||
delta = pos - self.event_start
|
||||
self.event_start = pos
|
||||
self.main_window.move(self.main_window.x() + int(delta.x()),
|
||||
self.main_window.y() + int(delta.y()))
|
||||
event.accept()
|
||||
return True
|
||||
|
||||
def mouseReleaseEventMainControls(self, event):
|
||||
if self.movewin_active:
|
||||
self.movewin_active = False
|
||||
event.accept()
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ class BeeGraphicsView(MainControlsMixin,
|
|||
self.previous_transform = None
|
||||
self.pan_active = False
|
||||
self.zoom_active = False
|
||||
self.movewin_active = False
|
||||
|
||||
self.scene = BeeGraphicsScene(self.undo_stack)
|
||||
self.scene.changed.connect(self.on_scene_changed)
|
||||
|
|
@ -71,7 +70,7 @@ class BeeGraphicsView(MainControlsMixin,
|
|||
# Context menu and actions
|
||||
self.build_menu_and_actions()
|
||||
self.control_target = self
|
||||
self.init_main_controls()
|
||||
self.init_main_controls(main_window=parent)
|
||||
|
||||
# Load file given via command line
|
||||
if commandline_args.filename:
|
||||
|
|
@ -646,14 +645,8 @@ class BeeGraphicsView(MainControlsMixin,
|
|||
event.accept()
|
||||
return
|
||||
|
||||
if (event.button() == Qt.MouseButton.LeftButton
|
||||
and event.modifiers() == (Qt.KeyboardModifier.ControlModifier
|
||||
| Qt.KeyboardModifier.AltModifier)):
|
||||
self.movewin_active = True
|
||||
self.event_start = self.mapToGlobal(event.position())
|
||||
event.accept()
|
||||
if self.mousePressEventMainControls(event):
|
||||
return
|
||||
|
||||
super().mousePressEvent(event)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
|
|
@ -674,15 +667,8 @@ class BeeGraphicsView(MainControlsMixin,
|
|||
event.accept()
|
||||
return
|
||||
|
||||
if self.movewin_active:
|
||||
pos = self.mapToGlobal(event.position())
|
||||
delta = pos - self.event_start
|
||||
self.event_start = pos
|
||||
self.parent.move(self.parent.x() + int(delta.x()),
|
||||
self.parent.y() + int(delta.y()))
|
||||
event.accept()
|
||||
if self.mouseMoveEventMainControls(event):
|
||||
return
|
||||
|
||||
super().mouseMoveEvent(event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
|
|
@ -695,11 +681,8 @@ class BeeGraphicsView(MainControlsMixin,
|
|||
self.zoom_active = False
|
||||
event.accept()
|
||||
return
|
||||
if self.movewin_active:
|
||||
self.movewin_active = False
|
||||
event.accept()
|
||||
if self.mouseReleaseEventMainControls(event):
|
||||
return
|
||||
|
||||
super().mouseReleaseEvent(event)
|
||||
|
||||
def resizeEvent(self, event):
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class WelcomeOverlay(MainControlsMixin, QtWidgets.QWidget):
|
|||
super().__init__(parent)
|
||||
self.control_target = parent
|
||||
self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
|
||||
self.init_main_controls()
|
||||
self.init_main_controls(main_window=parent.parent)
|
||||
|
||||
# Recent files
|
||||
self.files_layout = QtWidgets.QVBoxLayout()
|
||||
|
|
@ -123,6 +123,21 @@ class WelcomeOverlay(MainControlsMixin, QtWidgets.QWidget):
|
|||
self.layout.insertLayout(0, self.files_layout)
|
||||
super().show()
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
if self.mousePressEventMainControls(event):
|
||||
return
|
||||
super().mousePressEvent(event)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
if self.mouseMoveEventMainControls(event):
|
||||
return
|
||||
super().mouseMoveEvent(event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
if self.mouseReleaseEventMainControls(event):
|
||||
return
|
||||
super().mouseReleaseEvent(event)
|
||||
|
||||
|
||||
class BeeProgressDialog(QtWidgets.QProgressDialog):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue