MouseMoveEvent and QColorDialog

  • Hello,
    I have a problem with the mouse event when a QColorDialog is opened.
    The problem appends on a mac 10.9.4, with Qt5.2.
    I made a sample to display the problem:
    I open a QColorDialog on doubleClick event of the mainWindow. When the QColorDialog is closed an event MouseMoveEvent is send on the mainWindow. This event have no reason to be sent.
    Note : sometimes the mouseMoveEvent is not sent, I think it depends of the position of the dialog and mouse.

    The problem doesn’t appear on an ubuntu 13.04 with Qt5.2 and on Mac 10.6.8 with Qt4.8.
    Have you got any idea ?

    @void MainWindow::mouseDoubleClickEvent(QMouseEvent* event)
    qDebug()<<"MainWindow::mouseDoubleClickEvent "<<event->pos();
    QColorDialog::getColor( QColor(255,0,0) , this);

    void MainWindow::mouseMoveEvent(QMouseEvent* event)
    qDebug()<<"MainWindow::mouseMoveEvent "<<event->pos();
    if ( event->buttons() == Qt::LeftButton )

    void MainWindow::mousePressEvent(QMouseEvent* event)
    qDebug()<<"MainWindow::mousePressEvent "<<event->pos();

    void MainWindow::mouseReleaseEvent(QMouseEvent* event)
    qDebug()<<"MainWindow::mouseReleaseEvent "<<event->pos();

    Afeter double clic on mainWindow and select a color the console display:

    MainWindow::mousePressEvent QPoint(191,159)
    MainWindow::mouseReleaseEvent QPoint(191,159)
    MainWindow::mousePressEvent QPoint(191,159)
    MainWindow::mouseDoubleClickEvent QPoint(191,159)
    MainWindow::mouseMoveEvent QPoint(292,369)
    MainWindow::mouseReleaseEvent QPoint(292,369)

  • Qt Champions 2017

    I checked on windows as well. It does not send the move event as explained here. It seems to be bug to me. Did it cause any issue to you ? We can make work-around to fix this. Don't pass this as parent in second argument.
    i.e try with

    QColorDialog::getColor( QColor(255,0,0));

  • Thanks for your reply.

    I tried without parent but it doesn't work either.
    It is a problem for me, I have made a workaround with a boolean but it is not satisfactory.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.