SetCursor() doesn't work correctly



  • I use the function mouseMove_Event() to resize the QTableView's cells with the mouse and I have this weird issue with setCursor() function:

    When the cursor is over the horizontalTableView the cursor is correctly set to Qt::SplitHCursor
    but when it is over the verticalTableView the cursor is not set. Everything else in my code works fine. (I can resize both horizontalTableView and verticalTableView cells but in the second case the cursor is never set to Qt::SplitVCursor). I have also tested that the program enters the last if statement.

    Any ideas?

    Here is a part of my code:

    @void VDatagridView::mouseMove_Event(QMouseEvent * event, QObject object)
    {
    QTableView
    pT= dynamic_cast<QTableView*>(object);
    QPoint p = event->pos();

    if(pT==ui->horizontalTableView){
    

    // Do things for the horizontalTableView

        if (abs(p.x() - r.right() <= 1)
        {
            setCursor(Qt::SplitHCursor);
            event->ignore();
            return;
        }
        else unsetCursor();
    }
    else if(pT==ui->verticalTableView){
    

    // Do things for the verticalTableView

        if ( abs(p.y() - r.bottom() <= 1)
        {
            setCursor(Qt::SplitVCursor);
            event->ignore();
            return;
        }
        else unsetCursor();
    }
    

    }@



  • And here is an update that works fine.

    If I use QApplication::setOverrideCursor() nstead of setCursor() and unsetCursor() for both cases, the program works fine.

    But why shouldn't setCursor work in the first place?


Log in to reply
 

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