Try using QEasingCurve::InOutQuint, and you can use different setDuration() while showing and while hiding(), this will ensure a slow smotth show, and quick hide.
Try using QEasingCurve::InOutQuint, and you can use different setDuration() while showing and while hiding(), this will ensure a slow smotth show, and quick hide.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
rawfool (27th May 2013)
Now a small hiccup, after adding this auto-hide menu, if there is any widget that's overlapping the menu widget's region, then it's not responding and also the menu widget is shown under it.
So if there is any other widget, and when the menu widget is shown, it's moving under visible widget.
Is there anything like bring-to-front, etc, for bringing the menu widget to front. I tried setFocus(); but didn't solve the issue.
How do I bring the menu widget to top-most visible area and mouse hover on the other widgets in that page should be relative ?
I tried, but didn't work as expected:Qt Code:
menuWidget->setWindowFlags(Qt::WindowStaysOnTopHint); // menu widget is child of mainwidget(central Widget of main window) and is not in layout menuWidget->raise(); frmWidget->setWindowFlags(Qt::WindowStaysOnBottomHint);To copy to clipboard, switch view to plain text mode
EDIT: I'm able to bring it on top by adding the menubar at last. But the mouse move on the bottom widget isn't giving response to this to hide the menu widget, when out of the specified region.
Thank you.
Last edited by rawfool; 29th May 2013 at 12:40.
Then hide() the menu widget when the menu widget reveices QEevnt::Leave event, which indicated that mouse has left the menu widgetEDIT: I'm able to bring it on top by adding the menubar at last. But the mouse move on the bottom widget isn't giving response to this to hide the menu widget, when out of the specified region.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
rawfool (30th May 2013)
This is how I did that, but now the menu widget is not hiding,
I think my else if is wrong. Kindly help me correct this. Thank youQt Code:
{ { if(mouseEvent->pos().x() < 80) { if(isHidden() && (mAnimation->state() != mAnimation->Running)) { disconnect(mAnimation, SIGNAL(finished()), this, SLOT(hide())); mAnimation->start(); show(); } } { qDebug("Inside QEvent::Leave"); // This message is not getting printed if(!isHidden()) { connect(mAnimation, SIGNAL(finished()), this, SLOT(hide())); mAnimation->start(); } } } }To copy to clipboard, switch view to plain text mode
QEvent::MouseMove event is received for parent widget, and QEvent::Leave should be received for self widget, so move the else if out of if(parent() ==...., and also make suere to install the event filter on self. (this->installEventFilter(this);
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
rawfool (30th May 2013)
Thanks a lot. All the issues related to this are solved for now.
Just a small note, as this may help someone who do this. After doing this - it hides the widget.
A small problem persisted and it was - if there's a layout and widgets in the mouse-hover area, then the trigger didn't reach the menu widget. I solved it by making the layout and widgets as children to the same parent to which menu widget was and enabled mouse tracking true for the widget(s) on the way and this solved my problem.
Thank you.
Bookmarks