PDA

View Full Version : setCursor



^NyAw^
16th May 2008, 10:30
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,

maverick_pol
16th May 2008, 10:48
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

^NyAw^
16th May 2008, 11:02
Hi,

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

Thanks,

aamer4yu
16th May 2008, 11:11
QApplication::setOverrideCursor might help you :)

^NyAw^
16th May 2008, 11:50
Hi,

Thanks,

^NyAw^
16th May 2008, 13:01
Hi,

I'm not able to make it work.

I've tryied:

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

Thanks,

aamer4yu
16th May 2008, 13:07
How are u setting the code ??
Can we see the code ??

^NyAw^
16th May 2008, 13:12
Hi,

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



void MYmainWindow::mySlot()
{
setCursor(Qt::WaitCursor);
//Also tryied:
//QApplication::setOverrideCursor(Qt::WaitCursor);
}

aamer4yu
16th May 2008, 13:24
I guess, Line 5 should be

QApplication::setOverrideCursor(QCursor(Qt::WaitCu rsor));

u didnt make an object of the cursor !!

^NyAw^
16th May 2008, 13:43
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?