Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Cannot create transparent pixmap for QDrag
Forum Updated to NodeBB v4.3 + New Features

Cannot create transparent pixmap for QDrag

Scheduled Pinned Locked Moved Solved Mobile and Embedded
18 Posts 3 Posters 3.5k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    Boofish
    wrote on last edited by Boofish
    #6

    Probably worth noting that even if I just do this:

            QPixmap pixmap(size().width(), size().height());
            pixmap.fill(Qt::transparent);
            ...
            drag->setPixmap(pixmap);
    

    I still get a white pixmap. On both OS's. So this doesn't seem related to my toPixmap() function at all.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #7

      Are you using your own build of Qt ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      0
      • SGaistS SGaist

        Are you using your own build of Qt ?

        B Offline
        B Offline
        Boofish
        wrote on last edited by Boofish
        #8

        @SGaist No. On my dev machine I use open source qt that I installed either via apt-get install or by downloading the package and installing it. Can't remember which of the two but I certainly didn't build it manually. And on the board I use buildroot as mentioned already. Obviously, for the board build buildroot downloads and builds it. But I have not applied any patches on that so far either.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Boofish
          wrote on last edited by Boofish
          #9

          Sorry for the downvote on your previous post btw but the answer to one of your questions is already mentioned in my original question (i.e. qt version 4.8.6).

          SGaistS 1 Reply Last reply
          0
          • B Boofish

            Sorry for the downvote on your previous post btw but the answer to one of your questions is already mentioned in my original question (i.e. qt version 4.8.6).

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @Boofish said in Cannot create transparent pixmap for QDrag:

            Sorry for the downvote on your previous post btw but the answer to one of your questions is already mentioned in my original question (i.e. qt version 4.8.6).

            While I did miss you wrote the Qt version, the OS you are using is still legitimate, especially if you are using different flavours of Linux.

            Note that you are not even using the latest version of the Qt 4 series and also it has reached end of life a long time ago now.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            B 1 Reply Last reply
            2
            • SGaistS SGaist

              @Boofish said in Cannot create transparent pixmap for QDrag:

              Sorry for the downvote on your previous post btw but the answer to one of your questions is already mentioned in my original question (i.e. qt version 4.8.6).

              While I did miss you wrote the Qt version, the OS you are using is still legitimate, especially if you are using different flavours of Linux.

              Note that you are not even using the latest version of the Qt 4 series and also it has reached end of life a long time ago now.

              B Offline
              B Offline
              Boofish
              wrote on last edited by Boofish
              #11

              @SGaist Retracted the downvote. But anyway I would still like to fix the issue on this qt version preferably, for the reason I mentioned. I mean I'd like to identify the actual problem so if anyone knows what the bug is if it is indeed a bug, I can surely patch it. Also when you say "it has reached end of life a long time ago now" do you mean Qt4.8.6 or Qt4 in general?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #12

                Qt 4. There won't be any new bug fixes release unless there's a highly critical security issue. See here.

                One thing you can still try is Qt 4.8.7 if you can't update to a recent supported version of Qt.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                2
                • B Offline
                  B Offline
                  Boofish
                  wrote on last edited by Boofish
                  #13

                  Thanks for the responses. I'll try upping the version. I'll also dig into the code a bit more because the drag n drop robot example... works. Which is suspicious. And that is also using a pixmap in a QDrag from what I see.

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    Boofish
                    wrote on last edited by Boofish
                    #14

                    I'm going to leave this open in case I do find a solution, be it upping the version or whatever else (a quick google search shows that I'm not the only one that has had this issue or similar issues). I'll post it if I do maybe it will be helpful to someone else.

                    1 Reply Last reply
                    1
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #15

                      One thing that could help is to provide a minimal compilable example that reproduces that. So other people may have a look at it more easily.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • B Offline
                        B Offline
                        Boofish
                        wrote on last edited by
                        #16

                        I've found the solution. I had to patch qt source code to get this working. Here is the patch for anyone else struggling with this:

                        --- qt.old/src/gui/kernel/qdnd_qws.cpp	2019-07-04 02:22:03.051763167 +0300
                        +++ qt/src/gui/kernel/qdnd_qws.cpp	2019-07-04 02:22:36.895605031 +0300
                        @@ -97,6 +97,7 @@
                                 // setAttribute() should be done unconditionally!
                                 if (QApplication::type() == QApplication::GuiServer)
                                     setAttribute(Qt::WA_TransparentForMouseEvents);
                        +	setAttribute(Qt::WA_TranslucentBackground);
                             }
                         
                             void setPixmap(QPixmap pm)
                        --- qt.old/src/gui/kernel/qdnd_x11.cpp	2019-07-04 02:22:54.539523527 +0300
                        +++ qt/src/gui/kernel/qdnd_x11.cpp	2019-07-04 02:22:12.647718085 +0300
                        @@ -286,6 +286,7 @@
                                         | Qt::BypassGraphicsProxyWidget)
                             {
                                 setAttribute(Qt::WA_X11NetWmWindowTypeDND);
                        +	setAttribute(Qt::WA_TranslucentBackground);
                             }
                         
                             void setPixmap(const QPixmap &pm)
                        
                        jsulmJ 1 Reply Last reply
                        0
                        • B Boofish

                          I've found the solution. I had to patch qt source code to get this working. Here is the patch for anyone else struggling with this:

                          --- qt.old/src/gui/kernel/qdnd_qws.cpp	2019-07-04 02:22:03.051763167 +0300
                          +++ qt/src/gui/kernel/qdnd_qws.cpp	2019-07-04 02:22:36.895605031 +0300
                          @@ -97,6 +97,7 @@
                                   // setAttribute() should be done unconditionally!
                                   if (QApplication::type() == QApplication::GuiServer)
                                       setAttribute(Qt::WA_TransparentForMouseEvents);
                          +	setAttribute(Qt::WA_TranslucentBackground);
                               }
                           
                               void setPixmap(QPixmap pm)
                          --- qt.old/src/gui/kernel/qdnd_x11.cpp	2019-07-04 02:22:54.539523527 +0300
                          +++ qt/src/gui/kernel/qdnd_x11.cpp	2019-07-04 02:22:12.647718085 +0300
                          @@ -286,6 +286,7 @@
                                           | Qt::BypassGraphicsProxyWidget)
                               {
                                   setAttribute(Qt::WA_X11NetWmWindowTypeDND);
                          +	setAttribute(Qt::WA_TranslucentBackground);
                               }
                           
                               void setPixmap(const QPixmap &pm)
                          
                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #17

                          @boofish If this is really a Qt issue and you have a patch you should contribute it to Qt, so it gets integrated.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          B 1 Reply Last reply
                          1
                          • jsulmJ jsulm

                            @boofish If this is really a Qt issue and you have a patch you should contribute it to Qt, so it gets integrated.

                            B Offline
                            B Offline
                            Boofish
                            wrote on last edited by
                            #18

                            @jsulm Hi jsulm, this is on qt 4.8. I don't think this file even exists in the latest qt version.

                            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