Gamalof
17th June 2008, 19:10
i want to Get the position( x,y) of the cursor moving on my custom QGraphicsView Control
So, i made new class "MyQGraphicsView : QGraphicsView"
then i defined and implemented "mouseMoveEvent"
in MyQGraphicsView .h
void mouseMoveEvent ( QMouseEvent * event);
in MyQGraphicsView.cpp
void MyGraphicsViwer::mouseMoveEvent ( QMouseEvent * event )
{
MainForm->ui.Txt_xValue->setText((QString::number)(x()));
}
the problem is in the first mouse move, the Txt_xValue displays value 100, then it doesn't change where ever the mouse moves.
So ?
Thanks :)
So, i made new class "MyQGraphicsView : QGraphicsView"
then i defined and implemented "mouseMoveEvent"
in MyQGraphicsView .h
void mouseMoveEvent ( QMouseEvent * event);
in MyQGraphicsView.cpp
void MyGraphicsViwer::mouseMoveEvent ( QMouseEvent * event )
{
MainForm->ui.Txt_xValue->setText((QString::number)(x()));
}
the problem is in the first mouse move, the Txt_xValue displays value 100, then it doesn't change where ever the mouse moves.
So ?
Thanks :)