[Interest] Qt interfacing to Android native UI ?

Edward Sutton edward.sutton at subsite.com
Thu May 5 21:58:29 CEST 2016


I have not used the project.

My guess one motivating goal would be to reuse the many react-native modules that support both Android and iOS ( or one OS or the other ).

Another goal would be to access real native UI components and native API’s.  While QML looks native-like, for Android or iOS apps, native just feels better to the user IMO.

Microsoft is reportedly adding react native support for UWP and claim it will support 270 million Windows 10 devices.

https://blogs.windows.com/buildingapps/2016/04/13/react-native-on-the-universal-windows-platform/

-Ed

On May 5, 2016, at 9:45 AM, Jason H <jhihn at gmx.com<mailto:jhihn at gmx.com>> wrote:

What is the motivation for such a project?

Sent: Thursday, May 05, 2016 at 10:31 AM
From: "Edward Sutton" <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>>
To: "Robert Iakobashvili" <coroberti at gmail.com<mailto:coroberti at gmail.com>>
Cc: "interest at qt-project.org<mailto:interest at qt-project.org>" <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: Re: [Interest] Qt interfacing to Android native UI ?
An interesting project:

https://github.com/grassator/react-qml<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_grassator_react-2Dqml&d=CwMFaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=Ak4Y_J1BSYlKR4704Iql2q2CWBcXQyOWpaCQxWnvyf8&s=nkbAdNetZ-Iq9ZBOjOyzh0YXSVst8PVGnfWvs-m-92E&e=>

react-qml is a bridge library that allows to use React.js with QML.
Example

Usage of ReactQml is pretty straightforward — the only difference from web version is that you need to pass id of the qml item to React.render instead of DOM node. For example:

import QtQuick 2.4
import QtQuick.Controls 1.3
import "js/ReactQml.js" as React

ApplicationWindow {
    id: root
    title: qsTr("React QML")
    width: 300
    height: 300
    visible: true

    function reactRender(x, y) {
        var props = {
            x: 100,
            y: 100,
            width: 100,
            height: 100,
            color: '#000'
        };
        var childProps = {
            x: 25,
            y: 25,
            width: 50,
            height: 50,
            color: '#fff'
        };
        var child = React.createElement(React.Rectangle, childProps);
        React.render(React.createElement(React.Rectangle, props, child), root);
    }

    Component.onCompleted: {
        reactRender();
    }
}



-Ed

On May 2, 2016, at 1:50 PM, Robert Iakobashvili <coroberti at gmail.com<x-msg://11/coroberti@gmail.com>> wrote:

Dear Ekke,
Thank you for sharing your experience with
qt.labs.controls Qt Quick Controls2 in 5.7.

Sure, we'll be reading you blog.

Kind regards,
Robert


On Mon, May 2, 2016 at 8:38 PM, ekke <ekke at ekkes-corner.org<x-msg://11/ekke@ekkes-corner.org>> wrote:
I really like the new qt.labs.controls from Qt 5.6 (will become Qt Quick
Controls2 in 5.7)
using these lightweight controls together with Material Style (Android) or
Universal Style (Windows) with light or dark themes and all the new Controls
(like Drawer) for mobile-app-navigation and also HighDPI Support you can now
first time ever develop mobile apps with nearly native feeling. (iOS style
will come later when the new controls are stable)

I prefer to write UI in QML compared with React Native's mix of Markup and
JS or using Xamarin where you have one language but different code for
x-platform.

Before leaving QT for mobile apps - give it a try.
BTW: I'm writing a blog series about my experiences https://urldefense.proofpoint.com/v2/url?u=http-3A__j.mp_qt-2Dx&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=13ftz5U9_dHo8BjIh3RKmuX9DkqPXcAx9ctnx5a0YHA&e=   and
I'll develop - as proof of concept - Conference APPs for QtCon and Qt World
Summit.

ekke

Am 02.05.16 um 20:17 schrieb Robert Iakobashvili:

Dear Edward,
React Native - good catch.

Thank you so much for sharing this idea
and your experience!

Kind regards,
Robert


On Mon, May 2, 2016 at 8:08 PM, Edward Sutton <edward.sutton at subsite.com<x-msg://11/edward.sutton@subsite.com>>
wrote:

On May 1, 2016, at 4:27 AM, Robert Iakobashvili <coroberti at gmail.com<x-msg://11/coroberti@gmail.com>> wrote:

Dear Edward,
What are your conclusions and which direction you decided on
after your experiments?


I never made much progress. While QML looked more "native like” I never felt
comfortable using it.

I am doing my new iOS and Android development using Facebook's react-native.
React Native calls native UI from Javascript.

https://urldefense.proofpoint.com/v2/url?u=https-3A__facebook.github.io_react-2Dnative_&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=e9hAWWmY2S0Mo76_ex-_PF0NFk6ccgclP50872TSMfs&e=


When it makes sense I select UI components that have counterparts in Android
and iOS in order to increase code re-use.   I have seem claims of 85% code
re-use and from my experience  I do not doubt these claims.

So far, so good...

-Ed



Thanks,
Kind regards,
Robert


On Thu, Nov 5, 2015 at 2:40 PM, Edward Sutton <edward.sutton at subsite.com<x-msg://11/edward.sutton@subsite.com>>
wrote:

Hi Robert,

The approach you outlined below was the one I was considering. Use of common
C++ business layer, widgets for desktops, iOS native UI, and Android native
UI.

The Android native UI was my biggest concern.

I am going to continue experimenting with QML for a few more days


Hi Ben,

Thank you for sharing your Android UI interfacing code.  I will take a look.

Your iOS UI interfacing code was *very* helpful in understanding how to mix
C++ and Objective-C++ in the same *.mm file.  Java seems much more
challenging to interface to native UI.  However all I have done so far is
simple JNI calls into Java.

Thank you both,

-Ed


On Nov 5, 2015, at 1:51 AM, Ben Lau <xbenlau at gmail.com<x-msg://11/xbenlau@gmail.com>> wrote:


Not really a solution for wrapping Android UI in Qt app. But I have already
developed an image picker with native UI and communication library between
Qt and Java/Android. May be it could used as example / core framework.

Image Picker
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_benlau_quickandroid_blob_DEV_QuickAndroid_ImagePicker.qml&d=CwIBaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=nrrSNDcnq0DATI4qf2zrUTNMu_m6wsOws_Oz0VoTjAU&s=b9qfgeLoPCVjdDxzeFLLLuGl5EwnXG7Gv0sTjZwTjwU&e=

System Dispatcher - Invoke Java/Android function and vice visa without using
JNI. Data type conversion is handled automatically.

https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_benlau_quickandroid_blob_DEV_qasystemdispatcher.h&d=CwIBaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=nrrSNDcnq0DATI4qf2zrUTNMu_m6wsOws_Oz0VoTjAU&s=m04hl55EIBiEA7ELiqTGCj-dyEOx30iqkz2skvOT-rM&e=



-Ed


On Nov 5, 2015, at 1:36 AM, Robert Iakobashvili <coroberti at gmail.com<mailto:coroberti at gmail.com>> wrote:

Dear Ed,
It seems that I have something native for iOS, but not for Android.

I was thinking now about another path to take:

1. Common layer - with business app logic;

2. Presentation layer with the below options:

2.1 Qt Desktop layer to cover Win, Mac and Linux;
2.2 iOS-Native;
2.3 Android-Native.

Please, update us on your success of co-existence between
Qt-Widgets and QML and whether after adding QML it is still
sustains tough memory environment on iOS and low-memory
Android devices.

Thank you in advance.

Regards,
Robert


On Tue, Nov 3, 2015 at 5:12 PM, Edward Sutton <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>>
wrote:

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.

Thank you for your advice,

-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>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest&d=CwIBaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=nrrSNDcnq0DATI4qf2zrUTNMu_m6wsOws_Oz0VoTjAU&s=aIs7iOEK4KMToKD_jb-tP9y5aOCs9wfSJ8tXHkjMU1U&e=


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.


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>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=uqkwZ-luxwKEVRGiNcxeHyJJsLYoSoDf-8BpMtqNlGI&e=



--

ekke (ekkehard gentz)

independent software architect
international development native mobile business apps
BlackBerry 10 | Qt Mobile (Android, iOS)
workshops - trainings - bootcamps

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner

max-josefs-platz 30, D-83022 rosenheim, germany
mailto:ekke at ekkes-corner.org
blog: https://urldefense.proofpoint.com/v2/url?u=http-3A__ekkes-2Dcorner.org&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=ROE9tC5zKiyvW2K7t2UO997CRQQSluLCIoM811REO6I&e=
apps and more: https://urldefense.proofpoint.com/v2/url?u=http-3A__appbus.org&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=C74B2iQ6kB6KtX4Ox9CndK1CWN7IgAK6EBI6gXq8-ro&e=

twitter: @ekkescorner
skype: ekkes-corner
LinkedIn: https://urldefense.proofpoint.com/v2/url?u=http-3A__linkedin.com_in_ekkehard_&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=vAySIiYQSFceQQiKLG1CpgRKNiRU07W2tV1hcwMAy5I&e=
Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID: DE189929490


_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=uqkwZ-luxwKEVRGiNcxeHyJJsLYoSoDf-8BpMtqNlGI&e=

_______________________________________________
Interest mailing list
Interest at qt-project.org<x-msg://11/Interest@qt-project.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest&d=CwIGaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=5X_i0s6I6cbSYRP1ZGUPRMZL0OkDR9nmhuR8RAiIems&s=uqkwZ-luxwKEVRGiNcxeHyJJsLYoSoDf-8BpMtqNlGI&e=
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<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest&d=CwMFaQ&c=G4BpsyPyB19LB50bn2swXw&r=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc&m=Ak4Y_J1BSYlKR4704Iql2q2CWBcXQyOWpaCQxWnvyf8&s=1AyHT_EYX6RwxoYqwsBEL7sPlOdc4CpyW9ZDNCIX_54&e=>

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/20160505/fdef5554/attachment.html>


More information about the Interest mailing list