<html><head></head><body><div class="ydp9f3a7478yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div></div>
        <div dir="ltr" data-setdir="false">Olá Rui</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Just to share my experience with Qt widgets and QML. I had a simple desktop calculator app with Widgets and OpenGL graphics. </div><div dir="ltr" data-setdir="false">I had a c++ mindset and was ok doing that. When QML come around it was a bit strange and I had to leave my confort zone. </div><div dir="ltr" data-setdir="false">Eventually QML syntax become so pleasent to me and I found myself really enjoyng developing with qml / javascript. </div><div dir="ltr" data-setdir="false">I ported my app to QML based on the OpenGL under QMLexample. I started porting in the QML early days so I had to do a lot of "widgets" in qml from scratch wich was a bit of work. My app looks a lot better in QML and works for android and iOS with consistent look  and feel in all plataforms.</div><div dir="ltr" data-setdir="false">Also I find the qml development much faster than c++.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I also developed a game in qml. It has almost no relevant UI, but I had a very pleasent experience using javascript and qml features for the game logic (hello qml bindins, hello qml timer sintax). I never had performance problems, as some people say that javascript is slower than c++, but at the end of the day I think it also has a lot to do with your code algorithm and the type of app your developing. Btw I never had developed with javascript before, but if you are a c++ developer you will have no problems at all. </div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">If I had to start a new app today for desktop I would go for QML. Your app is for desktop today, but you never know when your users will start asking for a mobile or tablet version. </div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Cheers</div><div dir="ltr" data-setdir="false">João</div><div dir="ltr" data-setdir="false"><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_9295225382" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    Em quinta-feira, 22 de abril de 2021 19:41:06 GMT+1, Konstantin Shegunov <kshegunov@gmail.com> escreveu:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="yiv2499791107"><div><div dir="ltr"><div dir="ltr">On Thu, Apr 22, 2021 at 7:19 PM Giuseppe D'Angelo via Interest <<a rel="nofollow noopener noreferrer" shape="rect" ymailto="mailto:interest@qt-project.org" target="_blank" href="mailto:interest@qt-project.org">interest@qt-project.org</a>> wrote:<br clear="none"></div><div class="yiv2499791107gmail_quote"><blockquote class="yiv2499791107gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">
You should create a C++ layer (call it a "presentation" layer) that sits <br clear="none">
between your (possibly non-Qt) business logic and the UI. That layer <br clear="none">
contains stuff like item models, QObjects that expose the relevant <br clear="none">
business logic APIs, type wrappers, and so on.<br clear="none"></blockquote><div><br clear="none">Registering a struct/data class with the meta type system and/or marshaling it over QVariant, just so it can be visible in QML isn't that. Or things as natural (with C++) as having the UI raise some encapsulated piece of data in a signal (say some struct, say QColor or QVector3D) which the backend responds to isn't it either. As a matter of fact, how do you tie your existing backend to QML? Say we have this nice encapsulated UI that's completely decoupled from the business logic, how do I tie a specific object from the Quick scene and connect the notifications back to C++? I can't do it from the business logic (i.e. controller side), I have to expose the backend to the QML engine and do it from there, am I wrong? Basically you say it's fine that the UI drives the controller (incl. object creation)?<br clear="none"><br clear="none">We can agree on the principles, gladly, but this is really a gross oversimplification of the problem.<br clear="none"><br clear="none"></div><blockquote class="yiv2499791107gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">
While building this layering may be super tedious (YMMV), in the long <br clear="none">
run, it makes your application more robust, not less. The fact that QML <br clear="none">
_forces_ you to have this stuff becomes somehow a good thing.<br clear="none"></blockquote><div><br clear="none">Forces you? Do you mean, perhaps, that JS is somehow not supported, or maybe that Component.createObject is somehow hidden and/or inaccessible?<br clear="none"><br clear="none"></div><blockquote class="yiv2499791107gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">
On widgets, well, raise your hand if you didn't at least once connect a <br clear="none">
QPushButton to a slot declared in the widget that contains the button, <br clear="none">
and perform some business logic from there (yay business logic in the UI!).<br clear="none"></blockquote><div><br clear="none">Yes, it is done, and not without an honorable mention of the documentation, where the view-controller idiom is used extensively.  But then, raise your hand if you at least once didn't use an `if` (or some other JS piece of code) in a QML file. I can pull out for you numerous cases of it being done, probably too numerous to count even in the examples. Shooting yourself in the foot is not restricted to one language or another, nor to the technological solution in use is my point. You can make a holy mess of any piece of code on any language you choose, and QML certainly doesn't force you to do anything you don't *really want to*.<div class="yiv2499791107yqt5228755099" id="yiv2499791107yqtfd82637"><br clear="none"><br clear="none"></div></div><blockquote class="yiv2499791107gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"><div class="yiv2499791107yqt5228755099" id="yiv2499791107yqtfd34605">
In other words, being "entirely" in C++ has also its downsides.</div><br clear="none"></blockquote><div><br clear="none">Most certainly. One of the major downsides is it being much more complex and unforgiving, which doesn't necessarily mean it's better.</div></div></div><div class="yiv2499791107yqt5228755099" id="yiv2499791107yqtfd73417">
</div></div></div><div class="yqt5228755099" id="yqtfd49647">_______________________________________________<br clear="none">Interest mailing list<br clear="none"><a shape="rect" ymailto="mailto:Interest@qt-project.org" href="mailto:Interest@qt-project.org">Interest@qt-project.org</a><br clear="none"><a shape="rect" href="https://lists.qt-project.org/listinfo/interest" target="_blank">https://lists.qt-project.org/listinfo/interest</a><br clear="none"></div></div>
            </div>
        </div></body></html>