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..."

Using "describe", I can see that the last two parameters should be QFlags<>, which is a template class. However there are no setXXX methods, so I cannot make changes to the current mouse event. Is there a workaround?

- Rujia