Skip to content
  • 0 Votes
    5 Posts
    185 Views
    letsfindawayL

    @Pl45m4 Here is a short video of the application showing the issue:
    https://github.com/letsfindaway/OpenBoard/issues/203#issuecomment-2595705681

    The rubber is a pixmap cursor using QCursor. The circle is repositioned at each mouseMoveEvent. You see that it is lagging behind the cursor. The preview image to the left is the second view attached to the same scene.

    So you see, nothing complicated. And as I already said in the beginning: when I run the same program using Qt5, then the lag is much smaller, because the repetition rate of the mouseMoveEvents is higher.

    I have setMouseTracking(true), so that I get the events even when the mouse button is not pressed.

    And no, there are no further actions connected to the movement as long as the mouse button is not pressed.

  • 0 Votes
    2 Posts
    749 Views
    M

    Seems you need to enable mouse tracking for widget1, see:

    void setMouseTracking(bool enable)
    If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

  • 0 Votes
    10 Posts
    972 Views
    C

    I solved my problem via event filter of scene.

    ui->graphicsView->scene()->installEventFilter(this); bool MainWindow::eventFilter(QObject* obj, QEvent* event){ if(event->type() == QEvent::GraphicsSceneMousePress){ if(ui->addServerBtn->isChecked()){ QGraphicsSceneMouseEvent* mouseSceneEvent; mouseSceneEvent = static_cast<QGraphicsSceneMouseEvent *>(event); Server *serv = new Server(mouseSceneEvent->scenePos().toPoint()); scene->addItem((QGraphicsPixmapItem*)serv); } } return false; }