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
3 changes: 1 addition & 2 deletions examples/demo.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

import os

os.environ["ICONIFY_QTLIB"] = "PySide2"
os.environ["ICONIFY_PATH"] = os.path.dirname(__file__) + "/icons"

from PySide2 import QtCore, QtGui, QtWidgets

import iconify as ico
from iconify.qt import QtCore, QtGui, QtWidgets


app = QtWidgets.QApplication([])
Expand Down
3 changes: 1 addition & 2 deletions examples/modelViewUsage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import os


os.environ["ICONIFY_QTLIB"] = "PySide2"
os.environ["ICONIFY_PATH"] = os.path.dirname(__file__) + "/icons"


import iconify as ico
from iconify.qt import QtCore, QtGui, QtWidgets, QtSvg
from iconify.qt import QtCore, QtGui, QtSvg, QtWidgets



Expand Down
17 changes: 6 additions & 11 deletions iconify/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ def pixmap(self, size):

if self._anim is not None:
key = (
self._path, size, str(self._anim.__class__),
self._path, str(size), str(self._anim.__class__),
self._anim.frame(), color
) # type: PixmapCacheKey
else:
key = (self._path, size, "", 0, color)
key = (self._path, str(size), "", 0, color)

if key in self._pixmapCache:
return self._pixmapCache[key]
Expand All @@ -324,17 +324,12 @@ def pixmap(self, size):
painter.setTransform(xfm)

self._renderer.render(painter)
painter.end()

if self._color is not None:
# Use the alpha channel on a solid colour image
colorImage = QtGui.QImage(
size,
QtGui.QImage.Format_ARGB32_Premultiplied,
)
colorImage.fill(QtGui.QColor(self._color))
colorImage.setAlphaChannel(image.alphaChannel())
image = colorImage
painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceIn)
painter.fillRect(image.rect(), QtGui.QColor(self._color))

painter.end()

pixmap = QtGui.QPixmap.fromImage(image)
self._pixmapCache[key] = pixmap
Expand Down
3 changes: 3 additions & 0 deletions iconify/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@

if None in (QtCore, QtGui, QtSvg, QtWidgets, QtXml):
raise ImportError(_IMPORT_ERROR_MESSAGE.format(qtlib))

if qtlib == "PyQt5":
QtCore.Signal = QtCore.pyqtSignal