diff --git a/qtwidgets/colorbutton/colorbutton.py b/qtwidgets/colorbutton/colorbutton.py index 9d3ac1c..0998eaf 100644 --- a/qtwidgets/colorbutton/colorbutton.py +++ b/qtwidgets/colorbutton/colorbutton.py @@ -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. diff --git a/qtwidgets/toggle/toggle.py b/qtwidgets/toggle/toggle.py index f13217c..a1fa1e5 100644 --- a/qtwidgets/toggle/toggle.py +++ b/qtwidgets/toggle/toggle.py @@ -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