PDA

View Full Version : Hidden mouse cursor reappears when a QMenu is displayed



cristeab
15th July 2011, 06:44
Hi
I have hidden the mouse cursor when my application enters in full screen mode. In this mode the user is able to display a context menu implemented with QMenu and displayed synchronously with QMenu::exec. However, when the menu is shown the mouse cursor reappears, which I found annoying. Is there a way to keep the mouse cursor hidden even when the menu is displayed ?

regards
Bogdan

high_flyer
18th July 2011, 16:31
I have hidden the mouse cursor when my application enters in full screen mode
How did you implement that?
Does you QMenu object have a parent?

cristeab
20th July 2011, 08:15
How did you implement that?
Does you QMenu object have a parent?

Yes, my QMenu object has as parent the main window (in its constructor):


pagePopupMenu_ = new QMenu(this);
pagePopupMenu_->setBackgroundRole(QPalette::ToolTipText);
pagePopupMenu_->addAction("");
pagePopupMenu_->setEnabled(false);

Then, the mouse is hidden with (in another method of the main window)


setCursor(Qt::BlankCursor);

high_flyer
20th July 2011, 09:58
Hmm... this should work.
However, in a hidden cursor, you probably want it hidden in general (at that time) you you might try this:
QApplication::setOverrideCursor().