Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Native Windows style ignores Designer button size; Fusion style ignores DPI scaling

Native Windows style ignores Designer button size; Fusion style ignores DPI scaling

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 174 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Felipe Adulis
    wrote last edited by Felipe Adulis
    #1

    It's currently impossible to develop software in Qt that exactly matches the Designer layout. I am experiencing two critical issues with Qt 6 (6.10.2) on Windows:

    1. Native Windows style:
      QPushButtons created in the Designer do not preserve their defined size, even when using:
      sizeHint();
      setFixedSize();
      minimum and maximum;
      padding and margins

    Attempts to override sizeFromContents via QProxyStyle either fail or cause crashes.

    1. Fusion style:
      Button sizes are preserved, but the interface does not scale correctly on high-DPI monitors, breaking the layout.

    Impact:

    UI will never look exactly as designed in Designer;
    With native style, buttons have incorrect sizes; with Fusion style, layouts break on high-DPI displays;
    This makes Qt unsuitable for professional software.

    Suggestion:

    Provide a reliable way to force Designer-defined button sizes while using the native Windows style;
    Ensure the Fusion style scales correctly on high-DPI displays while preserving Designer-defined sizes.

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote last edited by
      #2

      Please provide a minimal. compilable example to reproduce the problem. I don't have problems with the fusion style on high-dpi displays (except some QPainter/QPen related stuff) so I don't know what's wrong on your side.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Felipe Adulis
        wrote last edited by Felipe Adulis
        #3

        Of course. My code is as simple as that:

        #include "mainwindow.h"
        
        #include <QApplication>
        #include <QLocale>
        #include <QTranslator>
        #include <QStyleFactory>
        
        int main(int argc, char *argv[])
        {
           QApplication a(argc, argv);
           a.setStyle(QStyleFactory::create("Fusion"));
        
           QTranslator translator;
           const QStringList uiLanguages = QLocale::system().uiLanguages();
           for (const QString &locale : uiLanguages) {
               const QString baseName = "Controle-XP-QT_" + QLocale(locale).name();
               if (translator.load(":/i18n/" + baseName)) {
                   a.installTranslator(&translator);
                   break;
               }
           }
           MainWindow w;
        
           w.show();
           return a.exec();
        }
        

        I'm just defining fusion style, what I've done rather than that is editing the UI in the editor, if U want I can send you teh repo, but I think it will be easy to reproduce if you stack a frame inside of another frame (with layout). In the images below you can see the difference between scale at 100% and 125%.
        Scale at 100%.png
        Scale at 125%.png

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote last edited by
          #4

          You mean the missing frame lines - this is what I meant with QPen related stuff.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Felipe Adulis
            wrote last edited by
            #5

            Oh, I see. That’s exactly it. I hope Qt fixes this! For now, I don’t see any workaround, since I can’t use the Windows style—as I mentioned, it doesn’t allow me to set the correct widget sizes. Of course, I could just accept it, but it puts Qt lower on the list among the many frameworks for developing cross-platform GUIs today. Also, in my case, I’m trying to completely redo a legacy software, so I wanted to keep the same sizes.

            1 Reply Last reply
            0
            • Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote last edited by
              #6

              I still don't understand what you mean with 'correct widget sizes'.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Felipe Adulis
                wrote last edited by
                #7

                I mean that: imagem_2026-02-19_140123842.png
                When using the Windows style, the OS overrides my design. As a result, the interface looks different from what I created in the designer—for example, buttons shrink and gain invisible margins that I cannot modify. I’ve tried changing properties in the designer, applying QSS, and using a proxy style, but nothing has any effect.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved