(Solved) Transparent Windows



  • Hi everybody, I'm creating a Qt Quick application for Desktop, and we need to make it borderless and with custom shape. I'm doing this this way:

    @int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QmlApplicationViewer viewer;
    viewer.setWindowFlags(Qt::FramelessWindowHint);
    viewer.setAttribute(Qt::WA_TranslucentBackground);
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/ParesTest/main.qml"));
    viewer.showExpanded();
    
    return app.exec();
    

    }@

    The thing is, opacity on parent node on main.qml doesn't work. If this parent node is a Rectangle, and I set its opacity to 0, I'll get an white rectangle on desktop. Is there any option to set on QmlApplicationViewer or this isn't supported?

    By the way, unfortunately, I'm using Windows 7..



  • Solved!

    @viewer.viewport()->setAutoFillBackground(false);@

    Above code solved the problem :)



  • You might encounter a serious limitation when using transparent window with a custom frame in qml - minimizing application makes the qml interface broken (on windows xp), see the bug I've reported here:

    http://bugreports.qt.nokia.com/browse/QTBUG-15429

    Or maybe you've got some solution? Then post it here, thanks.



  • Well, I can minimize and restore the Qml window and still see the contents, but it's pretty raw, just two rectangles on the screen.. Tomorrow when I arrive at work, I will test if I also have this hovering problem.

    Thanks for the tip



  • Yeah, it's MouseArea objects that are broken. I see that you're initializing it in a different way using QmlApplicationViewer, I'm doing it another way by extending QDeclarativeView (but also tried inside QMainWindow but it didn't help). So maybe your code won't encounter the hover bug, who knows. I see that you're testing on Windows 7, but if it works, if you could test it also under Windows XP please let me know, thanks.



  • Btw. I've already implemented dragging and resizing my custom framed window, also maximizing works fine (by default you may encounter a problem that maximize makes the window fullscreen, hiding the taskbar, I have it resolved). So if you have some problems I might be able to help you.

    Ahh and I also have custom drawn cursors working (default pointer and resize cursors) :)



  • I have the same problem with broken interface on minimize...



  • There is an another issue with transparent qml windows: dragging and resizing is very slow, on old computers (1.5 ghz, 1 core) the window is jumping and makes it a bad user experience.



  • Have you tried changing the renderer to a different one, like opengl? Some of them are faster on different hardware then others.



  • Yes, I tried opengl, but I get white screen with only some of the interface being drawn.

    http://bugreports.qt.nokia.com/browse/QTBUG-15429?focusedCommentId=133846#comment-133846


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.