Exemplo n.º 1
0
void MainWidget::mouseMoveEvent(QMouseEvent *event)
{


    if(event->buttons() & Qt::LeftButton)
    {
        this->trackball.move(pixelPosToViewPos(event->pos()), QQuaternion());
        event->accept();
    } else {
        this->trackball.release(pixelPosToViewPos(event->pos()), QQuaternion());
    }

}
Exemplo n.º 2
0
void Scene::wheelEvent(QGraphicsSceneWheelEvent *event)
{
	QGraphicsScene::wheelEvent(event);
	if (event->isAccepted())
		return;

	QPointF viewpos = pixelPosToViewPos(event->scenePos());

	pInput->fX = static_cast<f32>(viewpos.x());
	pInput->fY = static_cast<f32>(viewpos.y());

	u32 btn = 0;
	if (event->delta() > 0)
	{
		btn |= static_cast<u32>(Seed::ButtonUp);
	}
	else if (event->delta() < 0)
	{
		btn |= static_cast<u32>(Seed::ButtonDown);
	}

	pInput->PointerPress(viewpos.x(), viewpos.y(), btn);
	pInput->PointerRelease(viewpos.x(), viewpos.y(), btn);
	Dbg(">>>> WHEEL: %f,%f BTN: %x", viewpos.x(), viewpos.y(), btn);

	event->accept();
}
Exemplo n.º 3
0
void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
	QGraphicsScene::mouseReleaseEvent(event);
	if (event->isAccepted())
		return;

	QPointF viewpos = pixelPosToViewPos(event->scenePos());
	pInput->fX = static_cast<f32>(viewpos.x());
	pInput->fY = static_cast<f32>(viewpos.y());

	u32 btn = 0;
	if (event->button() == Qt::LeftButton)
	{
		btn |= static_cast<u32>(Seed::ButtonLeft);
	}
	if (event->button() == Qt::RightButton)
	{
		btn |= static_cast<u32>(Seed::ButtonRight);
	}
	if (event->button() == Qt::MidButton)
	{
		btn |= static_cast<u32>(Seed::ButtonMiddle);
	}

	pInput->PointerRelease(viewpos.x(), viewpos.y(), btn);
	Dbg(">>>> RELEASE: %f,%f BTN: %x", viewpos.x(), viewpos.y(), btn);

	event->accept();
}
Exemplo n.º 4
0
void Scene3D::mouseReleaseEvent(QMouseEvent* pe)
{
    if (pe->button() == Qt::LeftButton) {
		trackball.release(pixelPosToViewPos(pe->pos()), QQuaternion());
        pe->accept();
    }
}
Exemplo n.º 5
0
void Scene3D::mousePressEvent(QMouseEvent* pe)
{
   if (pe->buttons() & Qt::LeftButton) {
       trackball.push(pixelPosToViewPos(pe->pos()), QQuaternion());
       pe->accept();
   }
}
Exemplo n.º 6
0
void Scene3D::mouseMoveEvent(QMouseEvent* pe)
{   
    if (pe->buttons() & Qt::LeftButton) {
		trackball.move(pixelPosToViewPos(pe->pos()), QQuaternion());
        pe->accept();
    } 
    updateGL();
}
Exemplo n.º 7
0
void Scene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
	QGraphicsScene::mouseMoveEvent(event);
	if (event->isAccepted())
		return;

	QPointF viewpos = pixelPosToViewPos(event->scenePos());
	pInput->fX = static_cast<f32>(viewpos.x());
	pInput->fY = static_cast<f32>(viewpos.y());
	pInput->PointerMove(viewpos.x(), viewpos.y());
	//Log(">>>> MOVE: %f,%f", viewpos.x(), viewpos.y());
}
Exemplo n.º 8
0
void MainWidget::mousePressEvent(QMouseEvent *event)
{
    if(event->buttons() & Qt::LeftButton)
    {
       this->trackball.push(pixelPosToViewPos(event->pos()), QQuaternion());
       event->accept();
    }

    if(event->buttons() & Qt::RightButton)
    {
       this->mouseDownAction(event->x(), event->y());
       event->accept();
    }

}