[Interest] QML window icon

Alan Alpert 416365416c at gmail.com
Wed Jan 30 20:29:12 CET 2013


On Wed, Jan 30, 2013 at 12:58 AM, Mark Summerfield <mark at qtrac.eu> wrote:
> Hi Alan, Shawn,
>
> [snip]
>
> I tried doing the icon in C++ (on debian stable 64-bit, Qt 5.0.0):
>
>     int main(int argc, char *argv[])
>     {
>         QGuiApplication app(argc, argv);
>         QQuickView view(QUrl("qrc:/test.qml"));
>         view.setTitle("Test");
>         view.setIcon(QIcon(":/test.png"));
>         view.show();
>         return app.exec();
>     }
>
> and with test.qml and test.png in a .qrc file. In test.qml I replaced
> Window with Rectangle and deleted the title property.
>
> The window title appears correctly but the icon doesn't.

That sounds like a bug in QWindow. If you can reproduce that using a
QWindow instead of a QQuickView, please file a bug on
https://bugreports.qt-project.org/ . Make sure to mention your
environment, this might only happen with certain windowing systems.

> Incidentally, I notice that for most QML types the color property is
> really the background color; but for Text it is the foreground color.
> This seems a bit inconsistent but I guess is too late to change.

It's not actually inconsistent, because colors are split out a lot
more than in widgets or QML. For Rectangle and Window the color may
look like a "background" color, but it's just the color of the
Rectangle (which you probably put in the background). Same with the
text, there's no "background" color because the Text element does not
paint a background at all - it only paints text. So the color of Text
is the color of the text, and the color of Rectangle is the color of
the rectangle.

--
Alan Alpert



More information about the Interest mailing list