Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SetCursor() doesn't work correctly
Forum Updated to NodeBB v4.3 + New Features

SetCursor() doesn't work correctly

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 5.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    geracmos
    wrote on last edited by
    #1

    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();
    }
    

    }@

    1 Reply Last reply
    0
    • G Offline
      G Offline
      geracmos
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved