Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [PNG Icon color overlay] ColorOverlay vs IconImage
Forum Updated to NodeBB v4.3 + New Features

[PNG Icon color overlay] ColorOverlay vs IconImage

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 897 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nico88desmo
    wrote on last edited by
    #1

    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:

    1. using ColorOverlay
    2. 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 or QML_UNCREATABLE(reason) macros?

    GrecKoG 1 Reply Last reply
    0
    • N nico88desmo

      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:

      1. using ColorOverlay
      2. 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 or QML_UNCREATABLE(reason) macros?

      GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      @nico88desmo The other solution is using ColorImage, private like IconImage.
      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-104738

      As 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.

      1 Reply Last reply
      1
      • N Offline
        N Offline
        nico88desmo
        wrote on last edited by
        #3

        @GrecKo thanks for the reply.

        Now I'm evaluating to use ColorImage too, surely I prefer these solutions compare to ColorOverlay.

        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.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nico88desmo
          wrote on last edited by nico88desmo
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • N nico88desmo has marked this topic as solved on

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved