颜色或渐变转字符串 :param cls: :param gradient:
(cls, colorgradient)
| 146 | |
| 147 | @classmethod |
| 148 | def styleSheetCode(cls, colorgradient): |
| 149 | """颜色或渐变转字符串 |
| 150 | :param cls: |
| 151 | :param gradient: |
| 152 | """ |
| 153 | if isinstance(colorgradient, QColor): |
| 154 | return 'rgba({}, {}, {}, {})'.format(colorgradient.red(), |
| 155 | colorgradient.green(), |
| 156 | colorgradient.blue(), |
| 157 | colorgradient.alpha()) |
| 158 | gradientParameters = cls._styleSheetParameters( |
| 159 | colorgradient) + cls._styleSheetStops(colorgradient) |
| 160 | return cls._styleSheetFillName(colorgradient) + '(' + ', '.join( |
| 161 | gradientParameters) + ')' |