[Interest] Qt interfacing to Android native UI ?

Edward Sutton edward.sutton at subsite.com
Wed Nov 4 15:51:02 CET 2015


On Nov 3, 2015, at 5:40 PM, Federico Buti <fed.buti at gmail.com<mailto:fed.buti at gmail.com>> wrote:



On 3 November 2015 at 23:47, Edward Sutton <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>> wrote:
On Nov 3, 2015, at 4:24 PM, Federico Buti <fed.buti at gmail.com<mailto:fed.buti at gmail.com>> wrote:



On 3 November 2015 at 22:30, Edward Sutton <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>> wrote:

> On Nov 3, 2015, at 2:11 PM, Jason H <jhihn at gmx.com<mailto:jhihn at gmx.com>> wrote:
>
>
>
>> Sent: Tuesday, November 03, 2015 at 10:12 AM
>> From: "Edward Sutton" <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>>
>> To: "Qt Interest" <interest at qt-project.org<mailto: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<http://doc.qt.io/qt-5/qml-qtquick-extras-tumbler.html> 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.

​There are many open source projects out there with free components (look at Papyr material library<https://github.com/papyros/qml-material>. For what concerns PathView you can have a look to this<http://pastebin.com/embed_js.php?i=YnzFubvA> example of mine. Sure the code is not the most beautiful but at least is a working example of a date picker.


The material library looks very nice, very mobile-like.  The demo looks great on OSX.  I cannot run the demo on Android and iOS because it uses a qmlproject.  I need to figure out how to run the demo on Android and iOS to test usability and cross-platform consistency.

I am having layout or other issues that make the mixed widget / qml not display well or at all on Android and iOS when Combining Qt Widgets and QML with QWidget::createWindowContainer()<http://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer> .  Hopefully that is something that is solvable else the mixed QML and C++ widget approach may be a dead-end.

I will continue reading Interacting with QML Objects from C++<http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html>  with the goal of connecting a Tumbler added to Combining Qt Widgets and QML with QWidget::createWindowContainer()<http://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer>  to be readable and writable from C++.

Thanks again Federico.

-Ed




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<http://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer>.

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?

​Well, C++ to QML interaction is possible as well as the other way around. There are many resources ​available online. I have NO experience with Widget-mixed code so I can tell for that in detail. Anyhow, you should start from the resources provided by Sze Howe Koh and also have a look to the usage of "objectName" discussed here<http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html#accessing-members-of-a-qml-object-type-from-c> (and to that page in general).


Thanks Federico!

-Ed

​You're welcome. :)
F.​


​Cheers,
F.
​

-Ed

This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest

This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest

This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151104/57765694/attachment.html>


More information about the Interest mailing list