Results 1 to 3 of 3

Thread: The problem of the geometry() of QMenu?

  1. #1
    Join Date
    May 2012
    Posts
    11
    Qt products
    Qt4

    Default The problem of the geometry() of QMenu?

    I want to get the geometry of the QMenu before it being visible. I tried get the geometry at the aboutToShow() signal, but it seems to be out of control, the topLeft point of the menu's rect is always different to the QCursor:os(). Anyone know why? Or what is the right moment to get the geometry before it show?

  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: The problem of the geometry() of QMenu?

    you can try installing an event filter and catch QEvent::Show.
    ==========================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
    May 2012
    Posts
    11
    Qt products
    Qt4

    Default Re: The problem of the geometry() of QMenu?

    Yes, I got the right geometry in the showEvent(). Thank you!

Similar Threads

  1. QMenu and addAction problem
    By .:saeed:. in forum Newbie
    Replies: 0
    Last Post: 20th January 2011, 09:04
  2. problem with aboutToHide signal on QMenu
    By eric_vi in forum Qt Programming
    Replies: 2
    Last Post: 20th September 2010, 17:05
  3. [Qt] QMenu problem with method popup.
    By Xandareva in forum Newbie
    Replies: 1
    Last Post: 24th July 2010, 12:29
  4. QMenu Multiple selection problem
    By vajindarladdad in forum Newbie
    Replies: 3
    Last Post: 7th August 2009, 13:32
  5. problem in QMenu
    By wagmare in forum Qt Programming
    Replies: 0
    Last Post: 29th January 2009, 08:56

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.