[Interest] QML window icon

Mark Summerfield list at qtrac.plus.com
Wed Jan 30 10:14:36 CET 2013


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.

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.

Thanks!


-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Programming in Python 3" - ISBN 0321680561
            http://www.qtrac.eu/py3book.html



More information about the Interest mailing list