Results 1 to 8 of 8

Thread: Qt submenu offset issue

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt submenu offset issue

    Hi,
    I added a bug in the bug reports here :
    https://bugreports.qt.io/browse/QTBUG-47032
    Is it possible to solve this issue before a fix of Qt ?
    If possible, how solve it ?
    Thanks

  2. #2
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt submenu offset issue

    I tried to use stylesheet but no effect, maybe I did badly ?

  3. #3
    Join Date
    Oct 2014
    Posts
    81
    Thanks
    20
    Thanked 9 Times in 9 Posts
    Qt products
    Qt5
    Platforms
    Windows
    Wiki edits
    7

    Default Re: Qt submenu offset issue

    All the sub-menus in all the software here under Windows 8.1 seem to have the same behaviour, even in non-Qt software.

    Check other applications for yourself, like your web browser; I think this is from the OS.

  4. #4
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt submenu offset issue

    No way to change that to have it on the same height as the first menu and to not have the offset on the left ?

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt submenu offset issue

    On Windows 10, it is a bit different - in Firefox and Notepad++, submenus are offset about 5-10 pixels or so to the left, and about the same amount higher than the parent menu item. In Qt Assistant, the submenus are also offset to the left by about 10 pixels, but are aligned with the top of the parent menu item. In a Qt 5.4 app I have written, submenus have no offsets, either horizontally or vertically. That indicates it may not be an OS-controlled behaviour.

  6. #6
    Join Date
    Oct 2014
    Posts
    81
    Thanks
    20
    Thanked 9 Times in 9 Posts
    Qt products
    Qt5
    Platforms
    Windows
    Wiki edits
    7

    Default Re: Qt submenu offset issue

    Aren't the menu panels in Qt just QWidgets emulating the style of the OS?

    I'd look into styling the sub-menus position attributes: http://doc.qt.io/qt-5/stylesheet-ref...html#left-prop
    You can style individual widgets by giving them an object-name with setObjectName( "bla" ), then using "QMenu#bla" to identify that widget in the style sheet. You would style every single sub-menu.

  7. #7
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt submenu offset issue

    I solved the visual issue removing the margin on the QMenu stylesheet and not doing a border on the top like that :
    Qt Code:
    1. border-width: 0 1px 1px 0;
    To copy to clipboard, switch view to plain text mode 
    I added the info on the qt bug ticket here : https://bugreports.qt.io/browse/QTBUG-47032
    Qt should take account of it for sub-menu.

  8. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt submenu offset issue

    Quote Originally Posted by d_stranz View Post
    In a Qt 5.4 app I have written, submenus have no offsets, either horizontally or vertically. That indicates it may not be an OS-controlled behaviour.
    It might not be controlled by the OS/windowing system but it could be part of the platform's style or style guidelines. In which case software not using the native menus will have different accuracy of following these.

    A good idea when running into unexpected visualization is therefore to run with a different style plugin and, as already mentioned, to look at other, non-Qt software.

    Quote Originally Posted by Kryzon View Post
    Aren't the menu panels in Qt just QWidgets emulating the style of the OS?
    Depends.

    In general all widget based UI in a Qt application is drawn by Qt and styled using plugins.
    If there is a plugin for the specific platform then it might be very close to what the native UI components would do, if it is a cross platform style (e.g. fusion) then not.

    But the Qt Platform Abstraction module can also provide special integration for menus and menu bars.

    Cheers,
    _

Similar Threads

  1. Navigation in submenu and QAction
    By Ratheendrans in forum Qt Programming
    Replies: 0
    Last Post: 18th November 2011, 05:36
  2. Default action for submenu
    By mstegehu in forum Qt Programming
    Replies: 0
    Last Post: 23rd February 2011, 14:42
  3. Replies: 2
    Last Post: 7th July 2010, 12:18
  4. How to click and pop up submenu
    By shihao in forum Newbie
    Replies: 6
    Last Post: 22nd March 2010, 08:39
  5. How to show SubMenu next to MainMenu?
    By alex chpenst in forum Qt Programming
    Replies: 4
    Last Post: 17th July 2008, 10:33

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.