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. Regarding displaying busy cursor
Qt 6.11 is out! See what's new in the release blog

Regarding displaying busy cursor

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 5.3k 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.
  • I Offline
    I Offline
    Indrajeet
    wrote on last edited by
    #1

    Hi All

    I was performing some task in for loop so i want to display the cursor in busy mode untill that for loop is executed completly.
    I tried something like this

    @for(int i=0;i<size;i++)
    {
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    .
    .
    .
    .
    }
    QApplication::restoreOverrideCursor();
    @

    But in above case the cursor remains in busy state even after the loop is completed.

    How to reslove this?
    How to implement this?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      The cursor is pushed onto a stack, so you need to call restoreOverrideCursor as often as you did a setOverrideCursor. Check the documentation of those methods, it explains it.

      Move the setOverrideCursor outside of the loop.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        szuzsq
        wrote on last edited by
        #3

        In my opinion, setOverrideCursor is corresponding to restoreOverrideCursor,
        so you can either

        @
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
        for(int i=0;i<size;i++) {
        .
        .
        .
        }
        QApplication::restoreOverrideCursor();
        @


        or
        @
        for(int i=0;i<size;i++) {
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
        .
        .
        .
        QApplication::restoreOverrideCursor();
        }
        @

        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