Results 1 to 10 of 10

Thread: setCursor

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default setCursor

    Hi,

    I have a SLOT that is called by an action. In this SLOT I call "setCursor(Qt::WaitCursor)".
    The problem is that the cursor shows the WatiCursor only if the mouse is over the icon of the action, so if I move it to the centralWidget it shows the ArrowCursor, but if I move it again over the action it shows the WaitCursor again.

    I want the WaitCursor on all my application.

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Lightbulb Re: setCursor

    Hi,

    Did you set the cursor for your centerWidget?
    Different cursors can be set to different widgets, so maybe you haven't set the cursor for your centralWidget?

    Just an idea.

    Kacper
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: setCursor

    Hi,

    I want the cursor to all the application, so maybe I need to get the MainWindow pointer.

    Thanks,
    Òscar Llarch i Galán

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: setCursor


  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: setCursor

    Hi,

    Thanks,
    Òscar Llarch i Galán

  6. #6
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: setCursor

    Hi,

    I'm not able to make it work.

    I've tryied:

    QApplication::setOverrideCursor(Qt::ArrowCursor);
    QApplication::changeOverrideCursor(Qt::ArrowCursor );
    setCursor(Qt::ArrowCursor);

    Thanks,
    Òscar Llarch i Galán

  7. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: setCursor

    How are u setting the code ??
    Can we see the code ??

  8. #8
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: setCursor

    Hi,

    This is the slot that is called when the action is triggered

    Qt Code:
    1. void MYmainWindow::mySlot()
    2. {
    3. setCursor(Qt::WaitCursor);
    4. //Also tryied:
    5. //QApplication::setOverrideCursor(Qt::WaitCursor);
    6. }
    To copy to clipboard, switch view to plain text mode 
    Òscar Llarch i Galán

  9. #9
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: setCursor

    I guess, Line 5 should be
    QApplication::setOverrideCursor(QCursor(Qt::WaitCu rsor));
    u didnt make an object of the cursor !!

  10. #10
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: setCursor

    Hi,

    Your code and mine does the same.

    It set's the WaitCursor just a moment and then returns to ArrowCursor.

    Mmmm, the slot, changes the cursor and then calls a object method that starts a thread. If I disable the call to this method, the WaitCursor is correctly showed. So, when "QThread:start()" is called, the aplication restores it's original cursor?
    Òscar Llarch i Galán

Similar Threads

  1. setCursor
    By mickey in forum Qt Programming
    Replies: 4
    Last Post: 23rd April 2006, 20:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.