Using Qt for Mobile in 2023
camg.me
camg.me
That said, my troubles with Qt's performance and behavior on mobile led me to create my own cross-platform GUI library: https://github.com/styluslabs/ugui/
Your framework looks cool! I like that you have some flex support.
The only slight nitpick I have is the unity gui system is also called ugui so search conflicts might be annoying.
I have been a codenameone developer for 8 years now. On Android you run java and on ios you run static c which comes from the java code itself
Shai Almog and Steve Hannah have done a great job at making cn1 a comprehensible platform to develop on mobile. All the issues listed on this post are covered (scrolling with inertia, Android file system updates, etc)
I don't know how successful cn1 is in terms of users but I wish it were more popular on places like HN where React Native/Flutter is the bread and butter
The effort was already there anyway, so Qt wasn't bringing anything to the table, when a desktop app isn't part of the offering.
Everyone is looking for the magical WORA, however the reason Java failed at that, and Electron sucks, is that they are all leaky abstractions.
In reality, for delivering a good experience, knowing the underlying platform is still a requirement, and it only adds up in layers to debug, OS APIs to wrap, build tooling to integrate, IDE plugins for the platform SDK interoperability, and so on.
As frustrating as the web can be I’ll take that over being locked into a single platform proprietary toolkit.
The scrolling like you mentioned is subpar compared to native macOS one, so I hope Qt will address that. I saw someone mentioning `flickDeceleration` but at least on desktop it doesn't seem to change anything? Maybe it's because my delegates are so different from each other?
I also plan to support mobile version for my app in the future, so it's sad to read about the rest of the issues.
Here are some issues I've seen related to performance on mobile:
1) Opening a larger app is really slow (maybe 3-5 seconds), but works okay for smaller apps. I'm not sure what's going on behind the scenes and haven't had time to dive deep there yet, so this could be specific to me.
2) Rendering full pages is quite slower than native, as is QML rendering in general, even when using the QML compiler (which compiles your QML to C++)
3) Qt text rendering is a bit slow too, but you may not need i.e QTextDocument if you're implementing a text editor of some sort.
I have a component for it, it's 10-15 lines or so.
Regarding no.3, what do you mean by QTextDocument? My block editor is implemented by each delegate being a TextArea (inh: TextEdit), and it's very fast.
One trick I've learned, is to use `reuseItems`[1][2] in ListView. It gives incredible performance boost. You'll need to adjust some things according to the onPooled and onReused signals, but it's a no-brainer for many use cases.
[1] https://doc.qt.io/qt-6/qml-qtquick-listview.html#reuseItems-...
[2] https://doc.qt.io/qt-6/qml-qtquick-tableview.html#reusing-it...
I will try reuseItems again. It's something I tried before briefly but thought it may have been causing some rendering glitches and removed it. Maybe because I didn't implement onResused or onPooled properly. Thanks!
Yes, but without QTextDocument as I had some problems with it. I had to implement my own undo/redo/copy/paste/etc.
> It's something I tried before briefly but thought it may have been causing some rendering glitches
Yes, I've experienced some (minor) glitches that I've yet to figure out how to fix. For example, the cursor seems to (sometimes) jump when creating new blocks. Sometimes delegates reappear with animation (while I turned them off when onPooled ran). I'm trying to figure out if I'm doing something incorrectly (highly probable) yet I don't get these issues without reuseItems.
Sure, I hope it works out well for you (:
[1] https://www.kdab.com/development-resources/qt-tools/gammaray...
[1] https://doc.qt.io/qt-6/qtmultimedia-video-mediaplayer-exampl...
The UI is completely separated from the core of the app, and the core can be compiled natively or target Web Assembly.
I’m building the UI with HTML and JS (by the way, Web Components feel way better than React) and running the whole app in the browser (via WASM).
Eventually, I’d like to create native applications for all platforms, but I don’t have the time to spend on that right now. When the time comes, I’ll be able to easily remove the HTML frontend and bolt on a new one written specifically for the target platform.
This lets me prioritize dev speed in the short term and native UX in the long term.
I don't know the state of QWidgets on iOS/Android but my guess is it's even worse than QML if at all possible.
We heard that the Node.js version had quite high velocity initially, but slowed down greatly when it came to polishing. Like more than half of the time spent on the last 5%. The QML version also ran more smoothly.
The WebView on Android and iOS supports configuring an interop function. It allows you to map a JavaScript function to Java/ObjC functions. In my case, I had a single function with a single string argument, which I used to pass JSON messages.
I then implemented a callback mechanism where each message would get a unique ID. From JavaScript code, I could call a function in the shared C++ core and get a callback when data is returned.
The shared C++ code can directly access the internet and filesystem (I read in another comment that they changed this recently?).
The performance of the WebView is amazing, especially if you just rawdog it and write plain JavaScript. Modern JavaScript is nothing like it was back in the IE6 days.
With flat UIs, at the end of the day, who cares that it "doesn't feel native". What price are you willing to pay just so that it "feels native"?
The team is obviously incredibly talented and their coding style know-how matured over time, and I really want it to work, but unfortunately it still isn't there yet.
It was meant to be a declarative scripting language around their QGraphicsView back then iirc. That's how there was no QML Components for Desktop until quite a bit later. Then they made QtQuick a lot more fast/powerful in Qt5 by rewriting it on top of their new OpenGL scenegraph.
So what desktop design paradigms do you see in QML that make it unfit for mobile?
It seems to be the most accurate choice to answer the described needs while solving the lack of native dependency that QT is apparently facing.
It looks like the iOS support is in alpha though, and I'm curious if it uses native components on iOS?
Nancy FX was nice but most people used the Framework and it became the standard.
They have a WPF compatibility thing but it's "enterprise" overpriced.
It fits the classic Microsoft pattern of releasing a developer technology that doesn't quite work, then abandoning it before they ever finish it. For example, WinForms was meant to get hardware acceleration but, before then, was soft-deprecated in favour of WPF.
It seems like that isn't your experience, is that right? I'm genuinely curious because I want to like MAUI – I'd love a cross platform (Windows, Mac, Linux), hardware accelerated, C# GUI toolkit (that works and is supported).
My sense is that MS is all-in on "web ui" (html/css/[js|ts]). Native apps don't fit with the commercial imperative to get as much compute happening in Azure as possible. The Windows desktop increasingly has just one purpose: to maximise the likelihood that the end consumer will use Microsoft's cloud, and not someone else's. The Desktop UI is now a bedraggled mix of several UI toolkit generations, with many built-in apps going all the way back to the original Win API.
Microsoft's own headline apps - Office and Teams - have a web tech future. Teams started there, Office is going through a long, slow and somewhat painful migration.
Windows is slowly becoming just a remote desktop. You don't need native apps on those.
The problem with 3rd party frameworks is that you're always playing catch up. So if you're soloing it / developing a proof of concept you're good but if you're a real business you'd have a hard time selling me on anything but native.
You're thinking from the perspective of a solo developer making an ios app and nothing else.
If you are building an app which is supposed to be used by regular end consumers, native is the only real way to go. And as prizzom mentioned, choosing native iOS toolkit is a good idea if you want to sell, because Android users are not very keen on paying for apps.
slack uses html, steam uses extremely slow html… big companies do not care.
Steam also recently remade their apps. Authenticator and chat for steam uses native ui toolkit (styled to look like Steam desktop app). Store browsing still uses html frame, but that is less relevant for Steam on mobile.