Could you explain a bit more, or in other words what the problem is?I want to know if there's a simpler way
I really could not make out what the question is, so it could be others couldn't as well.
Cheers.
Could you explain a bit more, or in other words what the problem is?I want to know if there's a simpler way
I really could not make out what the question is, so it could be others couldn't as well.
Cheers.
The problem is that anytime that the mouse is out of the image surface the label has to be cleared. This means that if the mouse is under the menu bar, tool bar or status bar, the label has to be cleared. My question is if there's a way to do this better than reimplementig the mouseMoveEvent of the main window and check everytime if the current coordinates are under the image surface or not
Why not just keep track if QLabel has focus or not??My question is if there's a way to do this better than reimplementig the mouseMoveEvent of the main window...
Sorry my english is very poor and I don't know what you mean with
Could you tell me the same in other words, please?Why not just keep track if QLabel has focus or not??
I don't know how simpler this can be said...
Do you know what a focus is?
If you do, then i suggested, that you update the QLabel with the cursor position only if the QLabel with the image has focus...
This was not a simpler answer, but I don't know how to put it simpler then that....
Ok now I know what you want to sayBut I thought that the focus was only for the keyboard and also I don't know if there's a signal emitted when the image loss the focus because it's when I clear the label.
Last edited by SkripT; 18th January 2006 at 17:22.
You could grab mouse input, but that is not a good idea.
Well, then I don't see any better solution then to respond to mouseMoveEvent in the main window that hold the image QLabel.
But its not such a bad solution...
The only problem that I see with this solution is that i test if the cursor is under the image everytime that the cursor moves.
why?
you mean if you move over the QLabel the mouseMoveEvnt of the main widget reacts?
I can't remember if this should be this way (in a way it could make sense if the QLabel is a child of the main windows but even then I doubt it should be like that), but if it is, then you can do the inverse thing, in stead of reacting to the mainWindow mouseMoveEvent you can react to the mouseMoveEvent of the QLabel.
Actually this is the best solution now that I think of it.
The problem with this new solution that you suggest is that there's no way to know when the mouse isn't under the image surface and so the label is not cleared. I know it because is how I have implemented it now![]()
Bookmarks