[Interest] Qt interfacing to Android native UI ?

Sze Howe Koh szehowe.koh at gmail.com
Wed Nov 4 00:34:28 CET 2015


On 4 November 2015 at 06:47, Edward Sutton <edward.sutton at subsite.com> wrote:
> On Nov 3, 2015, at 4:24 PM, Federico Buti <fed.buti at gmail.com> wrote:
>
> On 3 November 2015 at 22:30, Edward Sutton <edward.sutton at subsite.com>
> wrote:
>>
>> > On Nov 3, 2015, at 2:11 PM, Jason H <jhihn at gmx.com> wrote:
>> >
>> >> Sent: Tuesday, November 03, 2015 at 10:12 AM
>> >> From: "Edward Sutton" <edward.sutton at subsite.com>
>> >> To: "Qt Interest" <interest at qt-project.org>
>> >> Subject: [Interest] Qt interfacing to Android native UI ?
>> >>
>> >> I know I can use native iOS UI by mixing Objective-C++ and C++ in the
>> >> same *.mm file.
>> >>
>> >> I have done a little Android JNI.  Are there any examples for
>> >> interfacing to Android native UI elements?
>> >>
>> >> I need to create a UI picker for manually entering GPS latitude and
>> >> longitude in degrees,  or degrees, minutes, seconds for a widgets app.  I
>> >> expect it will be hard to make a touch usable widget UI picker.  Developing
>> >> a native interface may take similar amount of time but result will be much
>> >> superior.
>> >
>> >
>> > >Define "much superior”?
>>
>> What the user expects. True native touch UI. Responsive and fast.
>>
>> >
>> > >Don't forget QML, which I think is the bee's knees. And then you have
>> > > one codebase for iOS and Android and Desktop, which to me is vastly
>> > > superior.
>>
>> Does QML have a numeric picker wheel ui element?
>
>
>>Since Qt 5.5 Tumbler is free.
>
>
> I just built and ran the Qt Quick Enterprise Controls and I saw tumbler.  I
> am glad it is free for others to use too.
>
> The PieMenu looked great too.
>
>
>  >Anyhow writing one in QML is quite easy using a PathView. Here is a
> component
>
>
> That was one of my concerns about QML.  Initially it looks like you could
> only use what Qt had created for you,  If something like a tumbler did not
> exist I assumed you were out-of-luck.  I need to research PathView and what
> it takes to create a new custom control.
>
>
>
>>
>> I have wanted to try creating UI elements in QML then display them in a
>> widget from my C++ Qt widget app.  I do not know if this is possible;
>> launching a QML ui then and receiving what the user selects from the QML UI.
>> It may be worth the effort.
>
>
>>
>> If I could mix some QML with my widget app it could be a better solution
>> compared to writing (and maintaining) two (2) native UI numeric pickers, one
>> for Android, and one for iOS.
>>
>>
>> So far I have one Qt widget codebase supporting Android, iOS, Linux, OS X,
>> and Windows desktops except for a few things like Bluetooth, sending email,
>> UIAlertView ( QMessageBox looks terrible on iOS ) and such.  If I start
>> adding native UI interfaces for Android and iOS I start to lose benefits of
>> Qt.
>
>
>>Mixing Qt Widget and QML is possible. Look at this blogpost.
>
>
> I just ran across that example.  It worked once I put the QML file into a
> resource.  However that example does not interact with C++.  I was hoping to
> find an example that would demonstrate how I could read the QML state from
> C++ ( or visa versa ).
>
> I assume ta QML toggle button could raise a toggled signal that a C++
> handler could react to?
>
> Or C++ could change the state of the QML toggle button?

See:
* http://doc.qt.io/qt-5/signalsandslots-syntaxes.html#connecting-c-objects-to-qml-objects
* http://doc.qt.io/qt-5/qtqml-cppintegration-topic.html


Regards,
Sze-Howe



More information about the Interest mailing list