Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. mousePressEvent in top-level QRubberBand
Forum Updated to NodeBB v4.3 + New Features

mousePressEvent in top-level QRubberBand

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 4 Posters 4.6k Views 3 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    I don't have permission to access that file.

    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
    0
    • pearseP Offline
      pearseP Offline
      pearse
      wrote on last edited by
      #5

      Sorry about that. Permissions are now set to public.

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

        I've moved the rubber band a bit to separate it clearly from the widget and when I click on it I get the message from the mouse press event.

        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
        0
        • pearseP Offline
          pearseP Offline
          pearse
          wrote on last edited by
          #7

          What OS are you on? And could you please elaborate one what you did to separate the two widgets? I am unable to reproduce your method.

          Is it not possible to have a top level rubber band over another widget and still receive click events?

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #8

            @pearse said:

            QRubberBand

            Hi
            Im not sure if helpful but it does set

            QRubberBand::QRubberBand(Shape s, QWidget *p)
            : QWidget(*new QRubberBandPrivate, p, (p && p->windowType() != Qt::Desktop) ? Qt::Widget : RUBBERBAND_WINDOW_TYPE)
            {
            ...
            setAttribute(Qt::WA_TransparentForMouseEvents); <<< is that ok ?

            Im not sure if poster want mousedown on the Band OR the widget under?

            1 Reply Last reply
            0
            • pearseP Offline
              pearseP Offline
              pearse
              wrote on last edited by
              #9

              Hi mrjj. Thank you for your time and help, and thank you too, to SGaist. I'm trying to overlay a persistent rubberband over the entire application, and capture any mouse event upon it so it can be moved.

              I've tried applying your constructor but I cannot seem to compile it. Does your constructor variable "QRubberBandPrivate" specify my overridden rubber-band (RBTest)?

              I also don't see documentation on the QWidget constructor that we're inheriting from here, the only one I do see only takes two arguments.

              I receive the following errors regarding QRubberBandPrivate:

              rbTest.cpp:28:16: error: allocation of incomplete type 'QRubberBandPrivate'
              : QWidget(*new QRubberBandPrivate(s,p), p, (p && p->windowType() != Qt::Desktop) ? Qt::Widget : RUBBERBAND_WINDOW_TYPE) {

              mrjjM 1 Reply Last reply
              0
              • pearseP pearse

                Hi mrjj. Thank you for your time and help, and thank you too, to SGaist. I'm trying to overlay a persistent rubberband over the entire application, and capture any mouse event upon it so it can be moved.

                I've tried applying your constructor but I cannot seem to compile it. Does your constructor variable "QRubberBandPrivate" specify my overridden rubber-band (RBTest)?

                I also don't see documentation on the QWidget constructor that we're inheriting from here, the only one I do see only takes two arguments.

                I receive the following errors regarding QRubberBandPrivate:

                rbTest.cpp:28:16: error: allocation of incomplete type 'QRubberBandPrivate'
                : QWidget(*new QRubberBandPrivate(s,p), p, (p && p->windowType() != Qt::Desktop) ? Qt::Widget : RUBBERBAND_WINDOW_TYPE) {

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #10

                @mrjj said:

                setAttribute(Qt::WA_TransparentForMouseEvents);

                Hi
                i was showing the call setAttribute and wonder if you want to click inside the band ?
                This flag disable mouse events for the widget as far as i know.
                I didnt mean you to use the constructor. the QRubberBandPrivate is not to be used outside so to speak.

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

                  I tested on OS X.

                  Nothing really special, I've set a geometry on the rubber band that was different that the one of the widget.

                  What do you want to do with that rubber band ?

                  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
                  0
                  • pearseP Offline
                    pearseP Offline
                    pearse
                    wrote on last edited by
                    #12

                    Hey guys, maybe I haven't been clear in my responses. I've made a youtube video that demonstrates the incorrect behavior I'm seeing. I hope this clears up what I'm trying to do:

                    https://youtu.be/_Xo8xksg1oY

                    mrjjM 1 Reply Last reply
                    1
                    • pearseP pearse

                      Hey guys, maybe I haven't been clear in my responses. I've made a youtube video that demonstrates the incorrect behavior I'm seeing. I hope this clears up what I'm trying to do:

                      https://youtu.be/_Xo8xksg1oY

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #13

                      @pearse
                      Hi
                      Win 10, mingw, Qt 5.6
                      It does work

                      1 Reply Last reply
                      0
                      • pearseP Offline
                        pearseP Offline
                        pearse
                        wrote on last edited by
                        #14

                        I should have specified that I'm on QT 4.8. Still, I don't think the behavior would change between versions.

                        Is this a bug?

                        mrjjM 1 Reply Last reply
                        0
                        • pearseP pearse

                          I should have specified that I'm on QT 4.8. Still, I don't think the behavior would change between versions.

                          Is this a bug?

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #15

                          @pearse
                          well could be bug in Qt 4.8 on OSX.
                          But maybe you could test with a newer Qt and see if its fixed in later releases ?

                          1 Reply Last reply
                          0
                          • pearseP Offline
                            pearseP Offline
                            pearse
                            wrote on last edited by
                            #16

                            Unfortunately I'm developing on a 12 year old code base built on Qt 4.8. We've looked into upgrading to 5.X but have found incompatibility issues. This is very unfortunate :(

                            Is there a bug reporting mechanism that I can use to file this problem? Thank you again for your help.

                            mrjjM 1 Reply Last reply
                            0
                            • pearseP pearse

                              Unfortunately I'm developing on a 12 year old code base built on Qt 4.8. We've looked into upgrading to 5.X but have found incompatibility issues. This is very unfortunate :(

                              Is there a bug reporting mechanism that I can use to file this problem? Thank you again for your help.

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by mrjj
                              #17

                              @pearse

                              • Unfortunately I'm developing on a 12 year old code base built on Qt 4.8
                                I didnt mean whole project. just the test project. To validate if 4.8 issue.
                                You can also look for similar sounding bugs
                                https://bugreports.qt.io/secure/Dashboard.jspa
                                and when/if u think its a bug, create report.
                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #18

                                One thing to take into account: Qt 4.8.7 was the last release and there will be no more Qt 4.8 releases in the future except if there's a security issues.

                                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
                                0
                                • pirannaP Offline
                                  pirannaP Offline
                                  piranna
                                  wrote on last edited by
                                  #19

                                  I've got the same problem on Ubuntu 16.04 and 16.10 on a new project, where the QrubberBand not get the mouse events and they go through to the underlying widget. Is there any workaround for that problem?

                                  I wanted to use Qt 5.7, but Ubuntu in its latest version only have up to Qt 5.5 and I've not be able to find documentation for that, so I've needed to stick with 4.8 :-(

                                  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