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. (Solved) Transparent Windows
QtWS25 Last Chance

(Solved) Transparent Windows

Scheduled Pinned Locked Moved QML and Qt Quick
10 Posts 3 Posters 10.7k 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.
  • P Offline
    P Offline
    puelocesar
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • P Offline
      P Offline
      puelocesar
      wrote on last edited by
      #2

      Solved!

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

      Above code solved the problem :)

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Cezary Tomczak
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          puelocesar
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Cezary Tomczak
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Cezary Tomczak
              wrote on last edited by
              #6

              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) :)

              1 Reply Last reply
              0
              • P Offline
                P Offline
                puelocesar
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Cezary Tomczak
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    patburke
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Cezary Tomczak
                      wrote on last edited by
                      #10

                      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

                      1 Reply Last reply
                      0

                      • Login

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