PDA

View Full Version : QTableWidget mouseEvents



QAir
28th July 2009, 10:02
Hello all,

I have implemented a Class that inhertis QTableWidget und implemented the mouseEvent methods:


void mousePressEvent(QMouseEvent* e);
void mouseDoppelClickEvent(QMouseEvent* e);
void mouseMoveEvent(QMouseEvent* e);


but I just receive a mousePressEvent when I doppel click on a widget. It is very curious!!! Has anyone an idea???
best regards

navi1084
28th July 2009, 10:08
Please provide sample code other than above
try using
void setMouseTracking ( bool enable ).

please check the spelling of mouseDoppelClickEvent();
it should be mouseDoubleClickEvent()

QAir
28th July 2009, 10:30
oh, yes, i misspelt double, thank you.
now the following:
at first double click, I still receive mosuePressEvent, after that I correctly receive mouseDoubleClickEvent.
and then I always receive the same mouseDoubleClickEvent, it doesn't matter where I double click on my QGraphicsView!!!

but I still don't receive mousePressEvent und mouseMoveEvent. I have to go mad!!!

setMouseTracking(true) doen't help. I want to receive a mouseEvent only on click, double click, and move (press mouse button, move, release mouse button) and not mouse over etc.

I hope somebody can help me

spirit
28th July 2009, 10:36
try this


graphicsView->viewport()->setMouseTracking(true);

QAir
28th July 2009, 12:25
graphicsView->viewport()->setMouseTracking(true); doesn't help too...

spirit
28th July 2009, 12:35
then, prepare compilable example which reproduces the problem and post it.

QAir
28th July 2009, 16:11
I have fixed the problem. The reason was that I implemented my own GrpahicsView and I had implemented the mouse events in my GraphicsView too.
It works perfect as soon as I remove the mouse events from MyGraphicsView.
Thanks for your answers.