Rujia Liu <rujia.liu@gmail.com> writes:How does your code look like? I can construct a QMouseEvent perfectly
> Hi!
>
> How to create a manual QMouseEvent? I wanna do this because I want to
> implement canvas dragging on midbutton. I'm referring to this code:
>
> http://levelfour.googlecode.com/svn/branches/dev/app/gui/GraphicsView.cpp
>
> It uses the following trick:
>
> if (event->button() == Qt::MidButton) {
> setDragMode(QGraphicsView::ScrollHandDrag);
>
> // create a new mouse event that simulates a click of the left button
> instead of the middle button
> QMouseEvent mouseEvent (event->type(), event->pos(), Qt::LeftButton,
> Qt::LeftButton, event->modifiers());
> QGraphicsView::mousePressEvent(&mouseEvent);
> }
>
> That is, when midbutton is down, set the dragging mode and simulate a
> leftbutton press. The mouse release handler is similar and is omitted here.
>
> But when I tried in CommonQt I can only get "No applicable constructor
> QMouseEvent found for arguments..."
fine here.
(#_new QMouseEvent (#_QEvent::None) (#_new QPoint) (#_Qt::NoButton)
(enum-or (#_Qt::LeftButton) (#_Qt::RightButton)) (#_Qt::NoModifier))
--
With best regards, Stas.