Is any dialog-zooming function exists?

  • Hi! I want to run my app on Android devices with different screen resolutions, but if dialog's size is more than screen resolution, then dialog does not fit on the screen. And I want to know, is any way to zoom dialog for the screens with different resolutions exists (all controls must change its coordinates, sizes and font-sizes too)? May be, I need to set any flag for the dialog?

  • Did you read the documentation on Qt's layout system?

    The font size does not automatically change, and it probably shouldn't. You cannot simply adapt to a smaller screen by making every thing on that screen smaller, especially not on a touch device. That results in unusable interfaces.

  • I could imagine such a feature. Every web browser can do that properly, so it should be technically possible.

    I also think that Qt is too much pixel-oriented. That was Ok in the past where all monitors and operating systems had only one fixed default dpi. But that has changed a lot and out CPU's (even on mobile devices) are powerful enough to scale images at runtime.

    I would like to enter sizes also in "em" like I can do with almost every element in HTML pages.

    A button with text adopts automatically to the size of the text. But a button with an Icon has a fixed size in pixels.

    Also, when I consequently use "em" everywhere, then I could modify the size of everything in one central point. Everything would depend on the font size of QApplication, when I modify this, then everything else would also change.

    I know that all Widgets can be created programmatically and also the sizes are changeable. But the GUI designer becomes almost useless if I do that.

  • If you want that kind of stuff, use QML instead of QWidgets. It is much more flexible and aimed at scalable, animated, fluid interfaces.

    Note that you can set the font size using a stylesheet at application level, and use QApplication::setGlobalStrut to make items sort-of scale with that.

  • If you want that kind of stuff, use QML instead of QWidgets
    Yes, I should try that.
    For the moment I prefer Widgets, maybe because I started programming 25 years ago. My mind tells me that QML comes with an incredible overhead. I always think like have do the work of my computers processor myself :-)

Log in to reply