Commit 5ed15087 authored by Dan Pascu's avatar Dan Pascu

Fixed handling mouse wheel events after the Qt5 migration

parent d715a5ce
...@@ -1955,10 +1955,11 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin): ...@@ -1955,10 +1955,11 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
elif watched in (self.latency_graph, self.packet_loss_graph, self.traffic_graph): elif watched in (self.latency_graph, self.packet_loss_graph, self.traffic_graph):
if event_type == QEvent.Wheel and event.modifiers() == Qt.ControlModifier: if event_type == QEvent.Wheel and event.modifiers() == Qt.ControlModifier:
settings = BlinkSettings() settings = BlinkSettings()
if event.delta() > 0 and settings.chat_window.session_info.graph_time_scale > GraphTimeScale.min_value: wheel_delta = event.angleDelta().y()
if wheel_delta > 0 and settings.chat_window.session_info.graph_time_scale > GraphTimeScale.min_value:
settings.chat_window.session_info.graph_time_scale -= 1 settings.chat_window.session_info.graph_time_scale -= 1
settings.save() settings.save()
elif event.delta() < 0 and settings.chat_window.session_info.graph_time_scale < GraphTimeScale.max_value: elif wheel_delta < 0 and settings.chat_window.session_info.graph_time_scale < GraphTimeScale.max_value:
settings.chat_window.session_info.graph_time_scale += 1 settings.chat_window.session_info.graph_time_scale += 1
settings.save() settings.save()
elif watched in (self.audio_encryption_label, self.video_encryption_label): elif watched in (self.audio_encryption_label, self.video_encryption_label):
......
...@@ -309,11 +309,17 @@ class VNCViewer(QWidget): ...@@ -309,11 +309,17 @@ class VNCViewer(QWidget):
x = event.x() x = event.x()
y = event.y() y = event.y()
button_mask = self.button_mask_map[event.buttons()] button_mask = self.button_mask_map[event.buttons()]
if event.type() == QEvent.Wheel: if event.type() == QEvent.Wheel and event.angleDelta():
if event.delta() > 0: wheel_delta = event.angleDelta()
wheel_button_mask = self.button_mask_map.vnc.WheelUp if event.orientation() == Qt.Vertical else self.button_mask_map.vnc.WheelLeft wheel_button_mask = 0
else: if wheel_delta.y() > 0:
wheel_button_mask = self.button_mask_map.vnc.WheelDown if event.orientation() == Qt.Vertical else self.button_mask_map.vnc.WheelRight wheel_button_mask |= self.button_mask_map.vnc.WheelUp
elif wheel_delta.y() < 0:
wheel_button_mask |= self.button_mask_map.vnc.WheelDown
if wheel_delta.x() > 0:
wheel_button_mask |= self.button_mask_map.vnc.WheelLeft
elif wheel_delta.x() < 0:
wheel_button_mask |= self.button_mask_map.vnc.WheelRight
self.client.mouse_event(x, y, button_mask | wheel_button_mask) self.client.mouse_event(x, y, button_mask | wheel_button_mask)
self.client.mouse_event(x, y, button_mask) self.client.mouse_event(x, y, button_mask)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment