Hi, I try to get the mouse position when there's a right click into the QMitkStdMultiWidget. But I only can get the middle of the mouse and not the tip. I've no idea how to change this. But as you can get the exact position with the normal left click into the widget there has to be a way to get it for the right click to ;)
Here is my code:
void mousePressEvent(QMouseEvent *e)
{
switch (e->button())
{
case Qt::RightButton:
if(::GetKeyState(VK_CONTROL) & KEY_DOWN) //right click + ctrl
{
mitk::Point3D point = getMousePosition(e->pos());
//set the crosshair to the position of the right mouse click
mitk::Geometry3D *geometry = myMitkImage->GetGeometry();
mitk::Point3D point3D;
geometry->IndexToWorld(point,point3D);
this->MoveCrossToPosition(point3D);
//emit signal to the main class
emit(rightClickAndCtrl(point));
}
break;
default:
break;
}
}
mitk::Point3D getMousePosition(QPoint point)
{
mitk::Point2D p;
p[0] = point.x();
p[1] = point.y();
mitk::Point2D p_mm;
mitk::Point3D position;
this->GetRenderWindow1()->GetRenderer()->GetDisplayGeometry()->ULDisplayToDisplay(p,p);
this->GetRenderWindow1()->GetRenderer()->GetDisplayGeometry()->DisplayToWorld(p,
p_mm);
this->GetRenderWindow1()->GetRenderer()->GetDisplayGeometry()->Map(p_mm,
position);
mitk::Geometry3D *geometry = myMitkImage->GetGeometry();
mitk::Point3D point3D;
geometry->WorldToIndex(position,point3D);
//round values to get correct voxel
point3D[0] = round(point3D[0]);
point3D[1] = round(point3D[1]);
point3D[2] = round(point3D[2]);
return point3D;
}
Can anyone help me?
Regards,
Claudia
binMhQUVXMFwe.bin
Description: Öffentlicher PGP-Schlüssel
------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
