Results 1 to 2 of 2

Thread: How do I get a QMenu to react to font size changes on High DPI diplays

  1. #1
    Join Date
    Jul 2015
    Location
    Sweden
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Question How do I get a QMenu to react to font size changes on High DPI diplays

    Testing High DPI support in Qt and I ran into an issue before I even got my test program done.
    The test is trivial, just a mainwindow with menu bar and a toolbar with actions.

    As I drag the program to and from the High DPI display the font size for menus change just as expected. But the size of the menu items don't update resulting in text that doesn't fit. This is just using the menus created by default in a mainwindow project in Creator.
    I naively thought menus would update layouts and sizes automatically when the text or fonts changed.

    QtMenuesIn4K.png

    Is there a way to get the menu bar to update when the font size changes due to moving the window to and from a High DPI screen?

    And as a follow up, is there any way to get the images in the actions both on the toolbar and menu items to change size depending on screen dpi?

    I've looked at the High DPI section in the 5.5 docs but I just don't understand how to apply what it say to the layout of menu bars and images attached to QActions.

    Could this possibly be related to me using windows style rather then a fully Qt controlled style for the application? Must test this with a non windows style when I get the chance.
    Last edited by mikag; 20th July 2015 at 17:21. Reason: updated contents

  2. #2
    Join Date
    Jul 2015
    Location
    Sweden
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How do I get a QMenu to react to font size changes on High DPI diplays

    Finally got around to testing this with the included Fusion style and menus still doesn't resize properly when the menu font grows.
    So if anyone have any experience with adopting widget based Qt apps for High Dpi displays I'd be so happy to hear what kind of solutions you used.

Similar Threads

  1. Replies: 1
    Last Post: 30th March 2012, 16:46
  2. Replies: 5
    Last Post: 7th September 2011, 12:59
  3. Font Height and width based on font size
    By Ghufran in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2010, 08:02
  4. adjust font size to QLabel-size
    By hunsrus in forum Qt Programming
    Replies: 0
    Last Post: 9th July 2008, 14:33
  5. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16

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.