Skip to content

[MRG+1] Use svg file for applicaiton icon on qt5 #8669

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

Merged
merged 1 commit into from
Jun 24, 2017

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented May 26, 2017

Currently QT5 uses a low resolution .png for the application icon; this uses the .svg instead which looks way better (top is svg, bottom is png):

screenshot from 2017-05-26 12-38-41

@tacaswell
Copy link
Member

I suspect that this is not an issue, but how far back does Qt support svg icons like this?

We just had two big breaks with Qt4 (the device dpi issue in 2.0.1 and a unicode issue (that I think is only on master?)) so I am extra nervous about that.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone May 26, 2017
@dstansby
Copy link
Member Author

It looks like it was supported in Qt 5.6: https://doc.qt.io/qt-5.6/qimagereader.html#supportedImageFormats, but I can't find any references in the 5.5 docs

@QuLogic
Copy link
Member

QuLogic commented May 26, 2017

The note here says that the SVG icon engine was added in Qt 4.2.

@tacaswell
Copy link
Member

@dstansby can you wrap this is a try-except ?

@QuLogic
Copy link
Member

QuLogic commented May 26, 2017

How old a Qt do we support?

@tacaswell
Copy link
Member

tacaswell commented May 26, 2017

Oh, never mind, we document only supporting >= 4.4 !

@tacaswell
Copy link
Member

Er, pyqt 4.4,

@tacaswell
Copy link
Member

I am completely failing to find any Qt version information in the PyQt docs. I am inclined to add the try...except, it is probably less work than trying to sort out if this is safe on all supported versions.

@QuLogic
Copy link
Member

QuLogic commented May 26, 2017

Based on this thread, theoretically any version of PyQt4 should work with any version of Qt and should at least support all the features up to the corresponding version, though I'd assume that some of the new features in Qt might not be available in older PyQt4.

So I guess we'd only need to check for exceptions wrt older Qt not supporting SVG (not any problems in PyQt4 itself), though I'm not sure what sort of exception it would be.

@dstansby
Copy link
Member Author

Would it be okay to just catch any exception?

@QuLogic
Copy link
Member

QuLogic commented May 27, 2017

I'm not even sure if this will raise anything. I tried converting the file to PSD and passing that in, but you just end up with a generic icon instead of an error. Don't know if this applies to older versions as I don't really have any way to try them out.

@dstansby
Copy link
Member Author

Hmm, maybe a compromise would be to add a high res .png file.

@QuLogic
Copy link
Member

QuLogic commented May 28, 2017

I think instead of passing a QIcon with the one file, you can create a QIcon of the primary SVG, then call addFile with the PNGs as fallbacks. There's already a double-size matplotlib_large.png (though I think Gnome Shell's icons are bigger than 48x48.)

@anntzer
Copy link
Contributor

anntzer commented Jun 23, 2017

http://doc.qt.io/qt-5/qicon.html states

Note: Since Qt 4.2, an icon engine that supports SVG is included.

Qt4.2 was released in 2006 (https://en.wikipedia.org/wiki/Qt_version_history#Qt_4) so if anyone complains I'd just update the minimum supported Qt version to 4.2 and call it a day.

@anntzer anntzer changed the title Use svg file for applicaiton icon on qt5 [MRG+1] Use svg file for applicaiton icon on qt5 Jun 24, 2017
@tacaswell tacaswell merged commit 03dd8e4 into matplotlib:master Jun 24, 2017
@dstansby dstansby deleted the qt5-svg-icon branch July 4, 2017 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants