-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from mlouielu/add-double-click-reset-slider-t…
…o-zero Add double click reset rotation slider to zero
- Loading branch information
Showing
3 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from PyQt6.QtCore import Qt | ||
from PyQt6.QtWidgets import QLabel | ||
|
||
|
||
class QClickableLabel(QLabel): | ||
"""Clickable QLabel | ||
When double clicked, the binded slider will be set to 0. | ||
""" | ||
|
||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
|
||
self._binded_slider = None | ||
|
||
@property | ||
def binded_slider(self): | ||
return self._binded_slider | ||
|
||
@binded_slider.setter | ||
def binded_slider(self, slider): | ||
self._binded_slider = slider | ||
|
||
def mouseDoubleClickEvent(self, event): | ||
if event.buttons() == Qt.MouseButton.LeftButton: | ||
if self.binded_slider: | ||
self.binded_slider.setValue(0) |