Results 1 to 20 of 32

Thread: Implementing MenuBar AutoHide function

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: Implementing MenuBar AutoHide function

    Seems u havent understood my program or I have understood what u wanted.
    I implemented auto hide like in taskbar in windows.

    What I do is, initially using the single shot timer I capture the geometry of the menubar. This is a private member, so its value is retained. As soon as I set the geometry cordinated in menuBarRect, I hide the menubar. So u wont see a menubar initially.
    When u move the mouse in the upper part of the window, where the menu is supposed to appear, I capture it, and show the menubar.

    Did u try running the code ?? or u just walked thru manually ?? also isMenuOn variable is not needed. I was just trying with that variable, and forgot to delete it.

    Also I havent seen your "trapezoidal menubar that appears on the top when you connect to Remote Desktop in Windows." so cant help u on that right now...

    if u have problem in running my code, ask me....

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: Implementing MenuBar AutoHide function

    what error were u getting before editing the code ??
    it was working fine for me...

  3. #3
    Join Date
    Mar 2007
    Location
    India
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Default Re: Implementing MenuBar AutoHide function

    Quote Originally Posted by aamer4yu View Post
    what error were u getting before editing the code ??
    it was working fine for me...
    It was? Thats strange. It did not work for me. I'll try again with your code. And try to find out.

  4. #4
    Join Date
    Feb 2007
    Posts
    16
    Platforms
    Windows
    Thanks
    1

    Default Re: Implementing MenuBar AutoHide function

    keep in mind that MouseMoveEvents only get passed when they move over the widget's editable boxes unless you have a mouse button pressed down.

    Because of this, your scrollbars and stuff like that don't process mousemove or mousepress events, AFAIK. I would assume it's the same way with the titlebar.

    Of course, I've never enabled mousemovement on a central widget so I don't know what kind of effect that will have on subchildren. Good luck getting this working.

  5. #5
    Join Date
    Mar 2007
    Location
    India
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Default Re: Implementing MenuBar AutoHide function

    Quote Originally Posted by giverson View Post
    keep in mind that MouseMoveEvents only get passed when they move over the widget's editable boxes unless you have a mouse button pressed down.

    Because of this, your scrollbars and stuff like that don't process mousemove or mousepress events, AFAIK. I would assume it's the same way with the titlebar.

    Of course, I've never enabled mousemovement on a central widget so I don't know what kind of effect that will have on subchildren. Good luck getting this working.
    thanks giverson!
    you made the post JIT

  6. #6
    Join Date
    Mar 2007
    Location
    India
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Thumbs up Re: Implementing MenuBar AutoHide function

    Guys,

    Thanks a lot for all the help! I finally implemented this.

    1. Created a custom widget.
    2. setGeometry( )
    3. Displayed the widget

    4. it _is_ true that the mouseMoveEvent did work ONLY on the parent form, and did not work when the mouse was over a child form (editable box, or anything else for that matter. in my case it was another widget). And truly, setting the mouse tracking to true for the parent widget did NOT work. but, when i also set the MouseTracking to true for the child widget, i found the PARENT widget getting singals of mouse movements on the child. To re-clarify, I set the setMouseTracking(true) in both the child and the parent widget, and implemented the mouseMoveEvent in the PARENT ONLY. and yet, on a mouseMove on the child, the function in the parent is always called.

    Is this behavior normal? That's the question!

    -vk

  7. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: Implementing MenuBar AutoHide function

    i dont know ...
    just tried to track in the code... what i was able to get is setAttribute is the function u have to dig for...
    Happy digging in the code,,, or wait till someone answers

  8. #8
    Join Date
    Mar 2007
    Location
    India
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Default Re: Implementing MenuBar AutoHide function

    Quote Originally Posted by aamer4yu View Post
    i dont know ...
    just tried to track in the code... what i was able to get is setAttribute is the function u have to dig for...
    Happy digging in the code,,, or wait till someone answers
    let me look into setAttribute( ) function.
    the behavior was really intriguing. and i tried replicating it again, and i was able to do so.
    somehow setting the mousetracking of a child widget sends signals to the mouseMoveEvent function of the parent.

    the experts should really explain this for the benefit of novices

    -vk

  9. #9
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Implementing MenuBar AutoHide function

    J-P Nurmi

  10. The following user says thank you to jpn for this useful post:

    viking (2nd April 2007)

  11. #10
    Join Date
    Nov 2010
    Posts
    142
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    24

    Default Re: Implementing MenuBar AutoHide function

    This post is really helpful!
    I applied it and it worked fine in Linux version.
    However it does not work in windows!
    the menu bar never appears, does this have to do with the coordinates of the windows screen?!

  12. #11
    Join Date
    Mar 2007
    Location
    India
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Default Re: Implementing MenuBar AutoHide function

    Quote Originally Posted by aamer4yu View Post
    Seems u havent understood my program or I have understood what u wanted.
    I implemented auto hide like in taskbar in windows.

    What I do is, initially using the single shot timer I capture the geometry of the menubar. This is a private member, so its value is retained. As soon as I set the geometry cordinated in menuBarRect, I hide the menubar. So u wont see a menubar initially.
    When u move the mouse in the upper part of the window, where the menu is supposed to appear, I capture it, and show the menubar.

    Did u try running the code ?? or u just walked thru manually ?? also isMenuOn variable is not needed. I was just trying with that variable, and forgot to delete it.

    Also I havent seen your "trapezoidal menubar that appears on the top when you connect to Remote Desktop in Windows." so cant help u on that right now...

    if u have problem in running my code, ask me....
    @ I did! And I ran it in debug mode as well. Thats when i found out that the control never enters to the part where it is supposed to show the menubar.

    @ I'll try to send you a screenshot of that "trapezoidal menubar that appears on the top when you connect to Remote Desktop in Windows." But hey, thanks for all the time man! Appreciate it a lot !!!

  13. #12
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: Implementing MenuBar AutoHide function

    @ I did! And I ran it in debug mode as well. Thats when i found out that the control never enters to the part where it is supposed to show the menubar.
    It does enter.... move the mouse close to the title bar....
    what platform are u using by the way ? I tried on windows with Qt 4.2.0 and its working fine for me. The menu shows up when u move the mouse just below the title bar area, where it shud appear

  14. #13
    Join Date
    Mar 2007
    Location
    India
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Default Re: Implementing MenuBar AutoHide function

    Quote Originally Posted by aamer4yu View Post
    It does enter.... move the mouse close to the title bar....
    what platform are u using by the way ? I tried on windows with Qt 4.2.0 and its working fine for me. The menu shows up when u move the mouse just below the title bar area, where it shud appear
    I tried! It did not work for me. Windows here too. But Qt 4.1.5. Could that be the reason? Doesnt seem so....

  15. #14
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: Implementing MenuBar AutoHide function

    it could be

Similar Threads

  1. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 23:04
  2. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 13:52
  3. Qt 4.1.4 plugin QPSQL
    By jcr in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd June 2006, 23:55
  4. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 09:52
  5. Replies: 25
    Last Post: 15th January 2006, 01:53

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
  •  
Qt is a trademark of The Qt Company.