Unsolved mousePressEvent in top-level QRubberBand
-
Hi and welcome to devnet,
Can you provide a minimal sample application that shows your issue with an OpenGL widget and QRubberBand ?
-
@SGaist Yes, the sample code is in the original post. Can you see it? There are three code tags, one for rbTest.h, the next for rbTest.cpp, and the final one is for main.cpp.
Alternatively, you can find the files in the zip file linked below:
https://drive.google.com/a/ucar.edu/file/d/0B44_2BA1czYlS1Y4WERpS3M0djQ/view?usp=sharingThanks!
-
I don't have permission to access that file.
-
Sorry about that. Permissions are now set to public.
-
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.
-
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?
-
@pearse said:
QRubberBand
Hi
Im not sure if helpful but it does setQRubberBand::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?
-
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) { -
@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. -
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 ?
-
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:
-
@pearse
Hi
Win 10, mingw, Qt 5.6
It does work
-
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?
-
@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 ? -
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.
-
- 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.
- Unfortunately I'm developing on a 12 year old code base built on Qt 4.8
-
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.
-
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 :-(