Update
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version. This library is distributed in the
|
||||
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from studiovendor import six
|
||||
from studiovendor.Qt import QtGui
|
||||
|
||||
import studioqt
|
||||
|
||||
|
||||
class Pixmap(QtGui.QPixmap):
|
||||
|
||||
def __init__(self, *args):
|
||||
QtGui.QPixmap.__init__(self, *args)
|
||||
|
||||
self._color = None
|
||||
|
||||
def setColor(self, color):
|
||||
"""
|
||||
:type color: QtGui.QColor
|
||||
:rtype: None
|
||||
"""
|
||||
if isinstance(color, six.string_types):
|
||||
color = studioqt.Color.fromString(color)
|
||||
|
||||
if not self.isNull():
|
||||
painter = QtGui.QPainter(self)
|
||||
painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceIn)
|
||||
painter.setBrush(color)
|
||||
painter.setPen(color)
|
||||
painter.drawRect(self.rect())
|
||||
painter.end()
|
||||
Reference in New Issue
Block a user