Results 1 to 4 of 4

Thread: Hidden mouse cursor reappears when a QMenu is displayed

  1. #1
    Join Date
    Dec 2010
    Location
    Versailles
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Hidden mouse cursor reappears when a QMenu is displayed

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Hidden mouse cursor reappears when a QMenu is displayed

    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?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Dec 2010
    Location
    Versailles
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Hidden mouse cursor reappears when a QMenu is displayed

    Quote Originally Posted by high_flyer View Post
    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):

    Qt Code:
    1. pagePopupMenu_ = new QMenu(this);
    2. pagePopupMenu_->setBackgroundRole(QPalette::ToolTipText);
    3. pagePopupMenu_->addAction("");
    4. pagePopupMenu_->setEnabled(false);
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. setCursor(Qt::BlankCursor);
    To copy to clipboard, switch view to plain text mode 
    Last edited by high_flyer; 20th July 2011 at 08:54. Reason: code tags

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Hidden mouse cursor reappears when a QMenu is displayed

    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().
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. The following user says thank you to high_flyer for this useful post:

    cristeab (20th July 2011)

Similar Threads

  1. Replies: 0
    Last Post: 28th June 2011, 07:41
  2. qt- mouse-cursor problem
    By magicsix in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 15th January 2011, 03:41
  3. Replies: 4
    Last Post: 26th November 2010, 10:55
  4. Mouse Cursor Problem
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 1st October 2007, 18:16
  5. How to hide mouse cursor
    By kiransu123 in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2007, 17:52

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.