Qt::WA_AlwaysStackOnTop influences font rendering in QML
-
Hi together,
I need a transparent QQuickWidget embedded in an QWidget UI. But to get this widget transparent, i have to set the window attribute "Qt::WA_AlwaysStackOnTop". But this influences the font rendering in Ubuntu.. There is no anti-aliasing anymore. If i comment this out, i have a black background (instead of transparent) but a nicely rendered font.
Does anybody has an idea?
Thank you very much in advance!
Frime -
Thanks for your response. But this is already done.. the window attribute "Qt::WA_AlwaysOnTop" has to be set in addition. "setClearColor(Qt::transparent)" only has no effect without this attribute..
Ilf i comment this line (setWindowAtttribut(Qt::WA_Alw...)) out, the the fonts are rendered with anti-aliasing but the background has no transparency anymore. Otherwise, the background is transparent but the fonts are rendered pixelated..
Any ideas?
Thank you very much in advance,
Frime -
Thanks for your response. But this is already done.. the window attribute "Qt::WA_AlwaysOnTop" has to be set in addition. "setClearColor(Qt::transparent)" only has no effect without this attribute..
Ilf i comment this line (setWindowAtttribut(Qt::WA_Alw...)) out, the the fonts are rendered with anti-aliasing but the background has no transparency anymore. Otherwise, the background is transparent but the fonts are rendered pixelated..
Any ideas?
Thank you very much in advance,
FrimeYes you're absolutely right! I have the same problem with this and I don't find any satisfaction solution.
I suppose this is a bug from Qt.I made this in this way:
view = new QQuickWidget(this);
view->setSource(QUrl(QStringLiteral("qrc:///qml/vs.qml")));
view->setClearColor(Qt::transparent);
view->setAttribute(Qt::WA_AlwaysStackOnTop);But this is not solution.
-
Yep, seems like a Qt Bug :/
My (unsatisfying) workaround: "copy" the background. In my case, I just have a pixelated background-texture I can use as background image.
But this should work also to fake a transparent QML Widget:
Grep the background and provide it via property binding to your QML world. Then you can set it as background-Image in QML.
This could help: http://stackoverflow.com/questions/10381854/how-to-create-screenshot-of-qwidget Not nice, but should work.Best,
Frime