Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupted icons with PyQt 5.12 #113

Closed
Adanteh opened this issue Feb 12, 2019 · 10 comments
Closed

Corrupted icons with PyQt 5.12 #113

Adanteh opened this issue Feb 12, 2019 · 10 comments
Milestone

Comments

@Adanteh
Copy link

Adanteh commented Feb 12, 2019

Hey, I had some issues with a corrupted windows profile, and after restoring it for some reason I can't get QtAwesome to show icons anymore. I did do a pip uninstall and install of qtawesome again. Normal QIcon are fine. Not sure on the technical side of this or how it could at all be connected, but I can't figure it out for the life of me.

image

Icons are being added normally as

import qtawesome as qta
qta.icon("fa5s.mountain") 
@ccordoba12
Copy link
Member

This is a problem with PyQt5 5.12 and we don't know how to fix it yet. So please downgrade to 5.11 in the meantime.

@Adanteh
Copy link
Author

Adanteh commented Feb 12, 2019

Thanks a lot, that fixed it.

@Adanteh Adanteh closed this as completed Feb 12, 2019
@stonebig
Copy link

an alternative is to switch to Spyder2 theme, instead of downgrading.

@ddemidov
Copy link
Contributor

Can this be reopened until the issue with pyqt 5.12 is resolved?

@ccordoba12 ccordoba12 reopened this Feb 19, 2019
@ccordoba12 ccordoba12 changed the title Corrupted icons Corrupted icons with PyQt 5.12 Feb 19, 2019
@stonebig
Copy link

@ddemidov
Copy link
Contributor

ddemidov commented Mar 6, 2019

Just a note: if I put some prints into CharIconEngine.__init__(), CharIconEngine.paint(), and CharIconEngine.pixmap() here:

class CharIconEngine(QIconEngine):
"""Specialization of QIconEngine used to draw font-based icons."""
def __init__(self, iconic, painter, options):
super(CharIconEngine, self).__init__()
self.iconic = iconic
self.painter = painter
self.options = options
def paint(self, painter, rect, mode, state):
self.painter.paint(
self.iconic, painter, rect, mode, state, self.options)
def pixmap(self, size, mode, state):
pm = QPixmap(size)
pm.fill(Qt.transparent)
self.paint(QPainter(pm), QRect(QPoint(0, 0), size), mode, state)
return pm

I can see that __init__() is being called, but neither paint() nor pixmap() are ever entered. Is that normal?

We are using qtawesome in our own project (thanks for the great library btw), so unfortunately switching to Spyder2 theme is not an option.

@ccordoba12
Copy link
Member

Thanks for digging into this! Did you try it?

@goanpeca, what do you think?

@ddemidov
Copy link
Contributor

ddemidov commented Mar 6, 2019

Just tried on a machine with pyqt 5.11 installed, and I here can see that both paint and pixmap are called. Here is the patch to iconic_font.py:

diff --git a/qtawesome/iconic_font.py b/qtawesome/iconic_font.py
index 0fb2896..727a557 100644
--- a/qtawesome/iconic_font.py
+++ b/qtawesome/iconic_font.py
@@ -147,16 +147,19 @@ class CharIconEngine(QIconEngine):
     """Specialization of QIconEngine used to draw font-based icons."""
 
     def __init__(self, iconic, painter, options):
+        print('init')
         super(CharIconEngine, self).__init__()
         self.iconic = iconic
         self.painter = painter
         self.options = options
 
     def paint(self, painter, rect, mode, state):
+        print('paint')
         self.painter.paint(
             self.iconic, painter, rect, mode, state, self.options)
 
     def pixmap(self, size, mode, state):
+        print('pixmap')
         pm = QPixmap(size)
         pm.fill(Qt.transparent)
         self.paint(QPainter(pm), QRect(QPoint(0, 0), size), mode, state)

I called example.py with the patch applied to test this.

@goanpeca
Copy link
Member

goanpeca commented Mar 6, 2019

I would need to look deeper into this, I don't recall working on that side, was more @SylvainCorlay I believe :-p

@ddemidov
Copy link
Contributor

https://www.riverbankcomputing.com/pipermail/pyqt/2019-March/041459.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants