Making labels completely nonclickable so you can click on other widgets behind it.
-
I have a rather wide slider with a label stuck in the middle of it showing how much 0-100% the slider is on. The problem is that the label, even while disabled (Which is default anyways), blocks the slider from being useable. In other words if you release the slider right on the label, you're no longer able to click on it because the label is in the way.
I'm sure there's an easy way to fix this, but my half useless googling and searching on several qt forums has not yielded any results.
Environment is windows 10 x64
-
Hi
You can use
setAttribute(Qt::WA_TransparentForMouseEvents);
and dont disable it. -
I have a rather wide slider with a label stuck in the middle of it showing how much 0-100% the slider is on. The problem is that the label, even while disabled (Which is default anyways), blocks the slider from being useable. In other words if you release the slider right on the label, you're no longer able to click on it because the label is in the way.
I'm sure there's an easy way to fix this, but my half useless googling and searching on several qt forums has not yielded any results.
Environment is windows 10 x64
I am not sure, if I understand correctly.
You have a label with a slider and both shall not be changable. However, you like to click something behind in the background and not visible?
If the background item is not visble, it should be clickable. Anything else not really what you should do, because that might be anything and especially something you do not anticipate to click. You have to bring items from the background to the foreground in order to make them accessible.If the something in the background is also part of your single application, it is my opinion basically the same. When it is part of the slider functionality you should integrate it somehow in the slider widget you are using.
-
I am not sure, if I understand correctly.
You have a label with a slider and both shall not be changable. However, you like to click something behind in the background and not visible?
If the background item is not visble, it should be clickable. Anything else not really what you should do, because that might be anything and especially something you do not anticipate to click. You have to bring items from the background to the foreground in order to make them accessible.If the something in the background is also part of your single application, it is my opinion basically the same. When it is part of the slider functionality you should integrate it somehow in the slider widget you are using.
@koahnig said in Making labels completely nonclickable so you can click on other widgets behind it.:
I am not sure, if I understand correctly.
You have a label with a slider and both shall not be changable. However, you like to click something behind in the background and not visible?
If the background item is not visble, it should be clickable. Anything else not really what you should do, because that might be anything and especially something you do not anticipate to click. You have to bring items from the background to the foreground in order to make them accessible.If the something in the background is also part of your single application, it is my opinion basically the same. When it is part of the slider functionality you should integrate it somehow in the slider widget you are using.
If you see the picture I uploaded, I have a label on top of the slider to make it very easily readable. However if I click on that part of the slider, it doesn't work because the label is in the way.
@mrjj said in Making labels completely nonclickable so you can click on other widgets behind it.:
Hi
You can use
setAttribute(Qt::WA_TransparentForMouseEvents);
and dont disable it.This works perfectly! Thank you so much :)