Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Runmode resolution seems to be scaled comparing to design mode



  • I am trying to do my first steps with qt5. Many years ago I was working with Borland C++ Builder and now I like to restart with qt5.

    I just started to design with qt designer of my test application.

    Then I compiled and test my code.

    I was wondering that the outout is not looking exactly as design mode. It seems that design mode for example is 200% and the run mode is 100% or the run mode will run in a different resolution.
    The window seems to be scaled smaller which is resposible for the problem.

    Please have a look at the image:

    qt5.jpg

    The label "Ampel 1", "Ampel 2" and "Test" are not shown completly. There are missing few pixel at the bottom and everything is smaller.

    Is there any way to prevent these problems or what can I do to let the application have the same dimensions as inside the designmode.


  • Lifetime Qt Champion

    You forgot to set a layout on your main widget.



  • Hi,

    thanks for the feedback. When I do a right mouse click on the main window, there I can choose some layout options. For example Layout Horizontally. When I set this and start the application again I have still the "scaling" effect.

    Is do you mean any other layout property?


  • Lifetime Qt Champion

    Please read the documentation on how to use the designer.



  • Thanks for the feedback. I understood the reason.

    In my example I put an traffic light image into a QLabel and used buttons which I styled to circle as light and placed them on the image. (this was pixel finetuning)

    When I think about the layout functionality I think my way with the images and buttons will not work with qt.

    I have not worked yet with painting functions in qt5. I think that qt5 will have canvas or equivalent for drawing pictures (traffic light) and place them into a grafic widget or equivalet.


  • Lifetime Qt Champion

    Hi

    • I think that qt5 will have canvas or equivalent for drawing pictures (traffic light) and place them into a grafic widget or equivalet.

    You can always just subclass Qwidget and add a paintEvent to it.
    Then use
    https://doc.qt.io/qt-5/qpainter.html
    to paint anything you like including images.

    In Qt its very easy to make custom Widgets.


Log in to reply