[PNG Icon color overlay] ColorOverlay vs IconImage
-
Dear All,
I'm developing an application using Qt/Qml 6.2 and I'd like putting an overlay color over a PNG icon.
I've found two ways to do this:
- using ColorOverlay
- using IconImage
The first option is available thanks to Qt 5 Compatibility APIs, however using such APIs for this single component isn't something I like too much.
The second option is "cleaner to use" and I see that is used inside all QML AbstractButton component, through icon-group property; my concerns about using this component is that it's a private component, so it isn't part of Qt public API components, in fact it isn't lists inside Qml component types.
My questions are:
- is it a bad idea using a private component?
- is there any other solution available?
In the end, just an opinion: it's quite strange that a private component is instantiable from "outside"; why not using an attached property or declaring that QML component as
QML_ANONYMOUS
orQML_UNCREATABLE(reason)
macros? -
@nico88desmo The other solution is using
ColorImage
, private likeIconImage
.
I'd say using one or the other isn't too risky and I believe they will be made public in the future.
JIRA issues to make them public : https://bugreports.qt.io/browse/QTBUG-66829 & https://bugreports.qt.io/browse/QTBUG-104738As to why they are instantiable from "outside", internal Qt code needs to instantiate it in QML and there's no way to limit where it's instantiable from so they are put in a "private" module but that's all that can be done reasonably.
-
@GrecKo thanks for the reply.
Now I'm evaluating to use
ColorImage
too, surely I prefer these solutions compare toColorOverlay
.Regarding "private" module, I don't understand why Qt developres haven't used any other kinds of solutions already used in Qt architecture, such as PIMPL idiom or Attached properties, which don't let final developer to instantiate them (unless these techniques limits some others functionalities); this is just a personal curiosity because I'm trying to understand as deeper as possible some Qt architectures choice... choices I can use for my developing too.
-
This post is deleted!
-