allow programLogo property to be a QIcon, too
ClosedPublic

Authored by cullmann on Jan 24 2020, 8:31 PM.

Details

Summary

rational: QIcon allows for better passing of HiDPI aware icons to the dialog

Test Plan

make && make test

tried out to use an QIcon in KTextEditor, seems to work and it looks "crisp"

Diff Detail

Repository
R263 KXmlGui
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cullmann created this revision.Jan 24 2020, 8:31 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 24 2020, 8:31 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
cullmann requested review of this revision.Jan 24 2020, 8:31 PM

Looks good to me, and very much in line with the other canConvert statements before.

apol accepted this revision.Jan 24 2020, 10:49 PM
This revision is now accepted and ready to land.Jan 24 2020, 10:49 PM
This revision was automatically updated to reflect the committed changes.

I propose to also extend the KAboutData::programLogo documentation to specify that QIcon is supported/expected. So this is not some surprise bebaviour.

While at it, please also note there recommended logo pixmap size usages, to avoid blurring.

Would something like this be ok?

Not sure what to write about sizes, e.g. for the program icon we don't mention anything either.

The QPixmap case was missing in the docs, too, btw.

diff --git a/src/lib/kaboutdata.h b/src/lib/kaboutdata.h
index 7b317f7..c9f8da0 100644
--- a/src/lib/kaboutdata.h
+++ b/src/lib/kaboutdata.h
@@ -750,8 +750,10 @@ public:
      * Use this if you need to have an application logo
      * in AboutData other than the application icon.
      *
-     * Because KAboutData is a core class it cannot use QImage directly,
-     * so this is a QVariant that should contain a QImage.
+     * Because KAboutData is a core class it cannot use QImage/QPixmap/QIcon directly,
+     * so this is a QVariant that should contain a QImage/QPixmap/QIcon.
+     *
+     * QIcon should be preferred, to be able to properly handle HiDPI scaling.
      *
      * @param image logo image.
      * @see programLogo()
@@ -964,8 +966,8 @@ public:
     /**
      * Returns the program logo image.
      *
-     * Because KAboutData is a core class it cannot use QImage directly,
-     * so this is a QVariant containing a QImage.
+     * Because KAboutData is a core class it cannot use QImage/QPixmap/QIcon directly,
+     * so this is a QVariant containing a QImage/QPixmap/QIcon.
      *
      * @return the program logo data, or a null image if there is
      *         no custom application logo defined.

Would something like this be ok?

Not sure what to write about sizes, e.g. for the program icon we don't mention anything either.

The program icon I have and such would assume others as well to be thought to have to satisfy the usual icon sizes (as defined for application cons in the xdg spec), given it is named "icon" after all.

For the programLogo things are different, logo display sizes are not specified somewhere (unless one indirectly assumes them given that the application icon is named as default). So possibly best would be to hint that any pixmaps passed here (via direct or also via QIcon) should follow the xdg icon spec, so have some 48x48 icon (or multiple of).

The QPixmap case was missing in the docs, too, btw.

Good catch :)

cullmann reopened this revision.Jan 30 2020, 5:26 PM

Then shortly reopen this, otherwise I forget to do this ;=)
Thanks for the feedback.

This revision is now accepted and ready to land.Jan 30 2020, 5:26 PM