Important: Please read the Qt Code of Conduct -

Scaling application (especially text) to screen size

  • Hello Qt devs!

    My application consists of several screens, which are build using layoutmanagers (I think that's the name for it).
    This works as intended, but I need the text to scale as well. Is there some "easy" way to do this?

    Thank you for your time!

  • First of all: we are talking about widgets here, right? Not about QML or anything like that?

    In the widget world, it is usually not not a good idea to start scaling text. The user has set his preferences for sizes of things like labels, and expects his applications to stick to that. There is no easy way to make the fonts scale dynamically either that I am aware of.

  • It is widgets, yes.

    The application is intended to run on a tablet with a 5 or 7" screen. But I cannot predict whether a bigger screen will be used in the future or not. Running the application on a computer, the application is scaled to full screen. -And of course the text is rather small compared to the widget sizes.

  • Are you sure you want to use widget based UI on a tablet? It sounds like QML is more suited for that.

    The OS probably provides sane default sizes for fonts. You might want to stick to using those. Also, take note of the difference of physical screen size and resolutions. That the widgets become small compared to the text may be just fine: the user choose to invest in a a bigger screen, and thus might want to see more information in one go. Or, you make sure you tweak your UI so it actually shows more elements if the screen has enough real estate to make that work better. There is no one-size-fits-all answer to this one.

  • Um I must admit I haven't looked into QML. I only heard the name the other day for the first time. Qt is also quite new to me. I previously spent most my programming-time working with C#.
    I just finished my education back in January. About 12 weeks ago I got an internship in a company - they then hired me a couple of weeks ago when my internship ended. I guess what I'm trying to say is that I was told to make a Qt application for this. But maybe they haven't looked into QML either. Maybe I should give this information to my superior and hear what he has to say about this :)

    Thank you for your time Andre!

  • QML is Qt. You just use a different paradigm to create the UI, but the backend would work just like any other Qt application. QML is just more suited for the kinds of interaction that users expect on platforms like phones and tablets: touch-based, animated, etc.

  • But QML has no ability to deal with the real-time, OpenCL/OpenCV, and GSL needs of real applications for machine automation, so its really not useful for much.

Log in to reply