Cursor is not changed when mouse is moving around the edges of a framed dockwidget
Hi everyone,
I've created a custom dockwidget with its custom titlebar. I've added a QFrame around the dockwidget and now, when the mouse is moving around the edges of the dockwidget, the cursor does not change to the sizehorcursor/sizevercursor shape.
Any ideas?
Thank you.
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
My idea is you messed up something in your code.
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
Hello again,
I must have messed up the whole code completely by now...
I'm still stuck with this issue. The thing is I don't know which widget/object/whatever is responsible for handling the cursor change when the mouse moves over the edges of a floating QDockwidget. Is this managed by the OS? (I hope not...)
When I hide the QFrame, everything seems to work fine, but when it is shown, something gets lost.
I want to give to my custom QDockWidget the appearance that a StyledPanel QFrame gives. Is there any other way to give that appearance getting rid of the QFrame? I couldn't add a "border" to the QDockWidget using stylesheets.
Thank you.
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
Resizing works. The problem is that the cursor doesn't change if the QFrame is shown.
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
Please prepare a minimal compilable example reproducing the problem.
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
Hi wysota, and thank you.
I hope the following code helps to understand my problem. The area of the "dock" that is not covered by the "frame" works fine (shows the resizing arrows).
Code:
ResizeArrowTest
::ResizeArrowTest(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
dock->setTitleBarWidget(titlebar);
titlebar->show();
dock->setAutoFillBackground(false);
this->addDockWidget(Qt::LeftDockWidgetArea, dock);
dock->setFloating(true);
frame
->setFrameShape
(QFrame::Shape::StyledPanel);
frame->show();
}
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
Please make your example compilable and minimal.
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
Sorry!
I hope it is "minimal" and "compilable" now...
Code:
#include <QtGui>
int main(int argc, char *argv[])
{
dock->setTitleBarWidget(titlebar);
w.addDockWidget(Qt::LeftDockWidgetArea, dock);
dock->setFloating(true);
frame
->setFrameShape
(QFrame::Shape::StyledPanel);
frame->show();
w.show();
return a.exec();
}
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
Why would you expect the above code to change the cursor shape?
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
As far as I understand, if I remove (or hide) the QFrame, it works as I want to.
Then, if I add the QFrame, resizing the dockwidget with the mouse still works, so why shouldn't the cursor change the shape if resizing is available?
My guess is: QFrame is handling some sort of event when the mouse is moving over the edges, and that event is missed by the object in charge of the cursor shaping. But which one is the event? Who is in charge of the cursor shaping? (the application, the OS, the dockwidget,...?)
Otherwise should I reimplement the shaping myself? How could I determine if I should use horizontal or vertical arrows?
Or probably the cursor shaping is handled by the OS. In that case I find myself a little bit (more) lost...
Am I pointing to some kind of wrong direction? Thanks a lot for your time.
Re: Cursor is not changed when mouse is moving around the edges of a framed dockwidge
I also tried using stylesheets to add a border instead of the QFrame but I couldn't get any success.
I think using QFrame should do the job, but I must be missing something.