Re: Changing cursor shape
try unset cursor for this label.
Re: Changing cursor shape
I'm sorry, but it not makes any changes.
And even, then what to do if I would like another cursor for window
and another cursor for label (see below)?
Thank you for your help!
Code:
Problem::Problem()
{
setWindowTitle(" ? ");
setGeometry(50,50,500,300);
setCursor(Qt::OpenHandCursor); // <--- cursor for window
Label->setFrameStyle(1);
Label->setGeometry(100,100,200,20);
Label->setCursor(Qt::IBeamCursor); // <---- cursor for label
}
{
setCursor(Qt::ClosedHandCursor);
setWindowTitle(" ClosedHandCursor "));
}
{
setCursor(Qt::OpenHandCursor);
setWindowTitle(" OpenHandCursor "));
}
Re: Changing cursor shape
Hi Odyseusz,
I don't get your problem to be honest. The first program works as expected: Whether you click on the window or on the label, the shape changes (because the label adopt the behavior of its parent (the window)). On the second, over the label it changes to IBeamCursor and even if you press it still have that shape, because you change the cursor on the window not on the label. And since the press event was on the label, it stays "active" even if you move the cursor over the window.
If that does not answer your question please elaborate what exactly you expect (based on which actions).
Best
Re: Changing cursor shape
I meant: Lable->unsetCursor();
Re: Changing cursor shape
------------------------------------------------------------
To MarekR22
------------------------------------------------------------
As I wrote in post #3 this instruction hasn't any effect!
Thank you for your help!
---------------------------------------------------------------------------
To Lykurg
---------------------------------------------------------------------------
First - I'm clicking on the window and the cursor changes as expected
(open hand - closed hand);
Next - I'm moving the cursor to the label and I'm clicking on this label:
in first example cursor changes as expected (open hand - closed hand),
in second example cursor changes to IBeam and of course not changes;
Then - I'm moving the cursor back to the window - in both cases the cursor
changes to open hand (as expected) - BUT, if now I'm clicking
on the window the cursor stays still open hand (no regard,
if I clicked on the label in step Next or only moved the cursor
over the label) - THIS IS MY PROBLEM!
Thank you for your help!
Sorry for my english!
Re: Changing cursor shape
Yep, it's happening and it's odd.
QCursor::shape() returns correct value in mousePress/Release but the visible shape of the cursor doesn't change.
No idea why it's happening.
Re: Changing cursor shape
Spitfire, thank you for your attempt!