Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions qtwidgets/colorbutton/colorbutton.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import sys
if 'PyQt5' in sys.modules:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt, pyqtSignal as Signal
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QPushButton

else:
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import Qt, Signal



class ColorButton(QtWidgets.QPushButton):
class ColorButton(QPushButton):
'''
Custom Qt Widget to show a chosen color.

Expand Down
3 changes: 2 additions & 1 deletion qtwidgets/toggle/toggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ def paintEvent(self, e: QPaintEvent):
0, 0,
contRect.width() - handleRadius, 0.40 * contRect.height()
)
barRect.moveCenter(contRect.center())
contRectCentered = contRect.center()
barRect.moveCenter(contRectCentered.toPointF())
rounding = barRect.height() / 2

# the handle will move along this line
Expand Down