Dynamically resizing of QML scenes



  • Hello,

    for industrial automation and SCADA I have developed an application mixed of Qt widgets and QML using QML 1.0 and QtDeclarative. The QML scenes have a lot of QML items inside like pipes, pumps, valves and tanks. These components have a specific position and size each connected to the other.

    You can see a picture "here":http://www.imb-web.de/index.php/fuelcontrolmenu.

    The problem is now, that this application needs to run on different resolutions, starting from 1024x768 until full hd resolution.
    My question is if there is a technique to resize a complex QML scene so that the items are also resized proportional and also there positions are moved proportional.
    I know of property binding but for a complex scene with hundreds of QML items it is not really a solution to calculate all the positions and width and height from the parent size so that it fits at the end.
    Also the scaling is not really a solution because the rendering of a scaled scene is rather bad, and especially text is not longer readable.

    Best regards

    Michael



  • I had a similar issue and for resolving that i've sent resolution of screen from qt to qml so the resolution of qml scene was calculated from resolution of screen. for other components i have no idea except your idea which mentioned above!! i know that's a big deal.
    However in the link that you provided, there is graph. Did you use it in your qml scene?! if so, then how did you do that? i've been seeking for it!



  • Thanks for your reply.
    The graph is not QML it is normal Qt using QWT.

    I also need to make software in C# .NET using WPF and there is a possibility to set the Brush of a border to a VisualBrush which contains another XAML scene. This XAML will be interpreted as a picture and can be resized without problems. Even animation is still possible. I thought there would be a similar comfortable solution in QML.

    Regards
    Michael



  • But the performance of WPF or C# maybe suffer you later! be careful!



  • I have the same resizing problem and would be happy if we find a solution... :)



  • you have to set scale for all of objects or set width and height of objects as percent of their parents, i haven't any better idea!



  • Hi mbrier,

    Did you tried QQuickView::setResizeMode(QQuickView::SizeRootObjectToView) in your main program.
    It takes care of the resolution in a better way.

    Regards
    Ansif


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.