Check cursor State



  • i am setting cursor state by QApplication::setOverrideCursor( Qt::WaitCursor );
    but i have to check whether the cursor is in normal form of not and then i have to call
    QApplication::restoreOverrideCursor();
    how can i check?

    if ( ? )
    QApplication::restoreOverrideCursor();



  • [[doc:QApplication]] takes care of that for you. It keeps an internal stack. All you need to do, is make sure that your number of setOverrideCursor calls matches the number of your restoreOverrideCursor calls.

    from the docs:
    [quote]Application cursors are stored on an internal stack. setOverrideCursor() pushes the cursor onto the stack, and restoreOverrideCursor() pops the active cursor off the stack. changeOverrideCursor() changes the curently active application override cursor.

    Every setOverrideCursor() must eventually be followed by a corresponding restoreOverrideCursor(), otherwise the stack will never be emptied.[/quote]



  • in our project .exe is setting cursor but our plugins after loading has to restore that so it is not possibe?



  • I don't quite get the requirement.



  • We have project called OrderXpress
    in our project we use two plugins photoXpress and AlbumXpress
    we load these plugins through container and setting cursor to wait state but in plugins
    it internally setting cursor for differnt modes so how can i identify the cursor state to restore it in plugins as our plugins did not have the knowledge of our container.



  • They don't need that knowledge. If they set their own cursor override, they should re-set it as well. The same goes for the container: if it sets the override, it should reset it as well.

    It's a good candidate for a RAII class, by the way.



  • Thanks sir.
    By the way which country u belongs to?



  • [quote author="neeraj2012" date="1333112470"]Thanks sir.
    By the way which country u belongs to?
    [/quote]
    Check my profile by clicking on my name next to my picture :-)



  • Got it , its my pleasure to have you sir .Thanks for your precious time but i will be available with my Questions so please guide me.


Log in to reply
 

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