UN-GCPDS / qt-material

Material inspired stylesheet for PySide2, PySide6, PyQt5 and PyQt6
https://qt-material.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
2.4k stars 254 forks source link

Full features example crashing when selecting new color in PyQt5 #38

Closed EloiZalczer closed 2 years ago

EloiZalczer commented 3 years ago

Hello,

I am trying to use the full_features example GUI app to create custom themes for my team. We use PyQt5 on python 3.7.

When selecting a color in the color picker, I am getting the following error:

Traceback (most recent call last):
  File "c:\users\ezalczer\documents\repositories\qt-material\qt_material\__init__.py", line 345, in iner
    for v in color_.toTuple()[:3]])
AttributeError: 'QColor' object has no attribute 'toTuple'

It appears that the toTuple method exists in PySide2 (https://doc.qt.io/qtforpython-5/PySide2/QtGui/QColor.html#PySide2.QtGui.PySide2.QtGui.QColor.toTuple), but is missing in PyQt5. Changing it to getRgb fixes the problem.

I am willing to make a PR, but I would like your opinion on how to make this change since we need to maintain compatibility with all Qt wrappers. My first idea is to use red(), green() and blue() instead of getRgb() or toTuple(), which seems like it would work for all platforms.

Thanks

YeisonCardona commented 2 years ago

Hi @EloiZalczer

Sorry for to late response, this will be fixed in the next commit.