QML (Qt5) binding for Julia (GSOC?)

659 views
Skip to first unread message

Maurice Diamantini

unread,
Mar 11, 2016, 10:35:27 AM3/11/16
to julia-users

While trying to find some Qt5 binding for Julia, I only found the Qt5 startup projet from Tom Breloff https://github.com/tbreloff/Qt5.jl which is intended to bind the full feature from Qt5. This is a huge task and will take some time.

So I wonder if there is some interest for a QML binding which would allows Julia code to display simple QML file (with callback to Julia methods!).

I just found a git repository about two QML library which could serve as a basis  and as an example:

Being able to build Qt interface directly from Julia without the need of  the anaconda would be a great advantage for Julia users.

That seems to be a true Julia GSOC candidate project (i.e. which could not be affected to another language...)

Regard,

-- Maurice


Mike Innes

unread,
Mar 13, 2016, 1:33:44 PM3/13/16
to julia-users
Hey Maurice,

Glad to see your interest in this project! I don't know a lot about this area personally, but you might be able to learn more about the approaches and issues involved by looking at Gtk.jl, which is a fairly complete effort in a similar area. Other than that, a simple protoype might help us to evaluate the idea.

I'd be interested in your take on the relative pros and cons of wrapping Qt5 wholesale vs. taking the QML approach you've described.

Cheers,
Mike

Diamantini Maurice

unread,
Mar 14, 2016, 6:04:02 AM3/14/16
to julia...@googlegroups.com, Maurice Diamantini
My interest in QML/Qt5 is limited as a user which is looking for a
reliable multi-platform toolbox for building gui applications (with
native menu, open and save box...).

There is the old designes Tk-8.6 which works everywere. But Julia
seams only to install Tk8.5.

Gtk is not (yet) really multi-platform although it claims to.
It is very promising... for years, much like the D language before
Go and Julia appear.
Also there is no much example on the github page.

So Qt5 would be the best solution (true multi-platform GUI, full feature
and very good documentation).
But Qt5 is a C++ code and even with the Cxx.jl package, I guess there
is much time before someone (Tom ;-) has time to build such an interface.
Also The library should be maintained.

In the meantime, I thought a QML binding would be easier to do (not by
me :) and above all easier to maintained because most features are
available in QML and there has no need (I think) to have its Julia
associated method.

Can someone who know QML confirm that?
Also what feature are provided by Qt5 which are not available with QML?

Regard,
-- Maurice

Uwe Fechner

unread,
Mar 14, 2016, 8:24:13 AM3/14/16
to julia-users, Maurice.D...@gmail.com
Well, I am not an expert on QML, but as far as I understand, QML is mainly for writing GUIs, whereas
the QT library contains a lot of functions for a lot of other tasks.

What Julia is missing is mainly an easy to use GUI toolkit, and QML could play that role.

Implementing a Julia - QML binding sound not so difficult as there is already a C binding.

I do not understand the following sentence:

"Being able to build Qt interface directly from Julia without the need of  the anaconda
would be a great advantage for Julia users."

If you would write a QML wrapper for the C binding, the C/ C++ code from the C wrapper
would still need to be compiled included in the package in some way (binutils). So there
would still be a dependency on C/C++ code (pre-compiled or not), that is always a little
bit difficult to install and to maintain.

Sounds like a great project!

Uwe

Mike Innes

unread,
Mar 14, 2016, 8:45:13 AM3/14/16
to julia-users, Maurice.D...@gmail.com
Ah ok, so you're not actually going for this project as a student? In that case, how about suggesting the project on the ideas page?

Tom Breloff

unread,
Mar 14, 2016, 8:57:44 AM3/14/16
to julia-users
On Mon, Mar 14, 2016 at 8:24 AM, Uwe Fechner <uwe.fec...@gmail.com> wrote:
Well, I am not an expert on QML, but as far as I understand, QML is mainly for writing GUIs, whereas
the QT library contains a lot of functions for a lot of other tasks.

What Julia is missing is mainly an easy to use GUI toolkit, and QML could play that role.

Implementing a Julia - QML binding sound not so difficult as there is already a C binding.

I do not understand the following sentence:
"Being able to build Qt interface directly from Julia without the need of  the anaconda
would be a great advantage for Julia users."

I'm just guessing here... you can currently get access to Qt functionality through PyQt (the python interface), which is currently wrapped through the package https://github.com/jverzani/PySide.jl.  There is also some functionality exposed through https://github.com/tbreloff/Qwt.jl, but I'd stay away from that unless you have a good reason.  These options require python, which in turn might depend on installing a big anaconda distribution. (again... just guessing why this was said).  A C/C++ wrapped solution might be slightly lighter-weight and faster.

Maurice Diamantini

unread,
Mar 14, 2016, 9:05:02 AM3/14/16
to julia-users, Maurice.D...@gmail.com
Le lundi 14 mars 2016 13:45:13 UTC+1, Mike Innes a écrit :

Ah ok, so you're not actually going for this project as a student?

No.

In that case, how about suggesting the project on the ideas page?

Because I'm not going to be a mentor neither!
I just wanted to suggest a binding QML as a potential GSOC.

-- Maurice

Andreas Lobinger

unread,
Mar 14, 2016, 9:05:18 AM3/14/16
to julia-users
Hello colleagues,

On Friday, March 11, 2016 at 4:35:27 PM UTC+1, Maurice Diamantini wrote:
So I wonder if there is some interest for a QML binding which would allows Julia code to display simple QML file (with callback to Julia methods!). ...That seems to be a true Julia GSOC candidate project (i.e. which could not be affected to another language...

just as a different flavour... It's not the first time people agree to have Qt5/QML or similar support for Julia would be great. However we still miss a working solution.

So maybe a better GSOC project would be to work on Clang and Cxx and similar to simplify FFI for julia?



 

Mike Innes

unread,
Mar 14, 2016, 9:11:45 AM3/14/16
to julia...@googlegroups.com
Sure, but adding a project idea doesn't commit you to being a mentor or anything. The ideas page is where students are going to take project suggestions from, so that's the best place if you want people to see it and potentially take it on.

Maurice Diamantini

unread,
Mar 14, 2016, 9:23:32 AM3/14/16
to julia-users, Maurice.D...@gmail.com


Le lundi 14 mars 2016 13:24:13 UTC+1, Uwe Fechner a écrit :
 
What Julia is missing is mainly an easy to use GUI toolkit, and QML could play that role.

That's exactly why I think a QML binding would be easier to do than a Qt5 one, and sufficient for most use case from Julia : no need to be able to use yet another string type et socket or http or..., just application GUI with callback to Julia methods.
 
Implementing a Julia - QML binding sound not so difficult as there is already a C binding.

I do not understand the following sentence:
"Being able to build Qt interface directly from Julia without the need of  the anaconda
would be a great advantage for Julia users."

Because I know there already exists a Python binding Qt4 (or there will be some day for Qt5) but it require about 1.2 G bytes in the `pkgs/v0.4/Conda` of the Julia directory.


If you would write a QML wrapper for the C binding, the C/ C++ code from the C wrapper
would still need to be compiled included in the package in some way (binutils). So there
would still be a dependency on C/C++ code (pre-compiled or not), that is always a little
bit difficult to install and to maintain.

Yes, but this extension should be more robust because less sensible to the Qt core changes...

 -- Maurice

Uwe Fechner

unread,
Mar 14, 2016, 3:01:01 PM3/14/16
to julia-users, Maurice.D...@gmail.com
Hello,

perhaps I could become mentor of such a project?
At least I know a little bit of Julia and a little bit of QML.

I am currently implementing optimizations and simulations
in Julia, and a QML GUI would be nice.

What would be needed to offer such a project?
Who much workload would be expected for a mentor?

Regards:

Uwe Fechner, TU Delft

Uwe Fechner

unread,
Mar 14, 2016, 3:01:57 PM3/14/16
to julia-users, Maurice.D...@gmail.com


On Monday, March 14, 2016 at 8:01:01 PM UTC+1, Uwe Fechner wrote:
Hello,

perhaps I could become mentor of such a project?
At least I know a little bit of Julia and a little bit of QML.

I am currently implementing optimizations and simulations
in Julia, and a QML GUI would be nice.

What would be needed to offer such a project?
How much workload would be expected for a mentor?

Mike Innes

unread,
Mar 14, 2016, 3:11:17 PM3/14/16
to julia-users, Maurice.D...@gmail.com
That would be great! There are guidelines from Google on mentorship which are a better authority, but roughly speaking you'd be looking at a few hours a week; time for a video call + answering questions over email and such. This will vary depending on the student, so student ability and mentor expertise and/or time commitment are things we'll weigh against each other when looking at proposals.

Uwe Fechner

unread,
Mar 14, 2016, 3:30:50 PM3/14/16
to julia-users, Maurice.D...@gmail.com
Ok, I added a pull request to the GSOC ideas page:
https://github.com/JuliaLang/julialang.github.com/pull/357

Is there anything else, I should do?

Uwe

Mike Innes

unread,
Mar 14, 2016, 3:45:58 PM3/14/16
to julia-users, Maurice.D...@gmail.com
That should be fine for now – the only other thing would be to keep an eye out for proposals and lend some feedback where possible.

Bart Janssens

unread,
Mar 15, 2016, 4:46:34 AM3/15/16
to julia-users
I just couldn't resist taking a stab at this using CppWrapper. At https://github.com/barche/QML.jl there is a small example on how to launch a QML file from Julia (tested in v0.4). To make this useful, we would need to add some kind of interface to the "embedding julia" interface, to allow binding Julia functions to QML signals. It should be relatively easy to write a custom Qt class to do that. The above QML.jl is set up to run moc if needed.

Cheers,

Bart

Maurice Diamantini

unread,
Mar 16, 2016, 8:15:30 AM3/16/16
to julia-users


Le mardi 15 mars 2016 09:46:34 UTC+1, Bart Janssens a écrit :
I just couldn't resist taking a stab at this using CppWrapper. At https://github.com/barche/QML.jl there is a small example on how to launch a QML file from Julia (tested in v0.4). To make this useful, we would need to add some kind of interface to the "embedding julia" interface, to allow binding Julia functions to QML signals. It should be relatively easy to write a custom Qt class to do that. The above QML.jl is set up to run moc if needed.

It work! Thank you very much. 
I've been able to install your QML.jl package (and the CppWrapper required package) then test the provided example.

However , I've not tried to convert the examples provided from the [https://github.com/seanchas116/**ruby-qml**](https://github.com/seanchas116/ruby-qml) binding.

Regard,
-- maurice
 

Bart Janssens

unread,
Mar 16, 2016, 8:37:19 AM3/16/16
to julia-users
Awesome, reassuring to know it works elsewhere too :)

In the mean time, I updated the test with a simple Julia callback to increase a counter on the Julia side at the click of a QML button. The interface is limited to 0-argument functions returning integers or doubles for now. The heart of the code is here:
https://github.com/barche/QML.jl/blob/master/deps/src/qml_wrapper/wrap_qml.cpp#L25-L53

Anyone wanting to use this for something real will definitely need to extend that part of the code to support more arguments and other types.

Cheers,

Bart

Uwe Fechner

unread,
Mar 16, 2016, 11:39:31 AM3/16/16
to julia-users
Hello,

unluckily it does not work for me yet.

I get the following error:

julia> Pkg.test("QML")
INFO: Testing QML
/usr/bin/julia: symbol lookup error: /home/ufechner/.julia/v0.4/QML/deps/usr/lib/libqml_wrapper.so: undefined symbol: _ZN9QMetaType22registerNormalizedTypeERK10QByteArrayPFvPvEPFS3_S3_PKvEi6QFlagsINS_8TypeFlagEEPK11QMetaObject
=================================[ ERROR: QML ]=================================

failed process: Process(`/usr/bin/julia --check-bounds=yes --code-coverage=none --color=yes /home/ufechner/.julia/v0.4/QML/test/runtests.jl`, ProcessExited(127)) [127]

================================================================================
ERROR: QML had test errors
 in error at ./error.jl:21
 in test at pkg/entry.jl:803
 in anonymous at pkg/dir.jl:31
 in cd at file.jl:22
 in cd at pkg/dir.jl:31
 in test at pkg.jl:71

julia>



I am using Ubuntu 14.04 and QT 5.5.1 .

Any idea?

Diamantini Maurice

unread,
Mar 16, 2016, 2:47:47 PM3/16/16
to julia...@googlegroups.com, Maurice Diamantini
Did you successfully install CppWrapper (https://github.com/barche/CppWrapper)?

<pre>
Pkg.clone("https://github.com/barche/CppWrapper.git")
Pkg.build("CppWrapper")
</pre>

-- Maurice

Bart Janssens

unread,
Mar 16, 2016, 2:49:10 PM3/16/16
to julia-users
Hi,

I think this is because the dynamic linker can't find your Qt libs. I have pushed a fix that should add the correct library to the rpath. After pulling the change, you may need to delete .julia/v0.4/QML/deps/usr and .julia/v0.4/QML/deps/builds for Pkg.build to detect the change. If it still fails after that it may be best to open an issue, to avoid clutter here.

Cheers,

Bart

Uwe Fechner

unread,
Mar 16, 2016, 3:10:49 PM3/16/16
to julia-users
I am now on a different computer, and "using QML" now works.

Pkg.test("QML") still fails, but with a different error:

julia> Pkg.test("QML")
INFO: Testing QML
QQmlApplicationEngine failed to load component
file:///home/ufechner/00PythonSoftware/FastSim/main.qml:-1 File not found


Which file main.qml should I use for testing?
I have many files with this name on my computer.

Best regards:

Uwe Fechner

Uwe Fechner

unread,
Mar 16, 2016, 3:22:29 PM3/16/16
to julia-users
Ok, I disabled my .juliarc.jl file.

Now I get another error:


julia> Pkg.test("QML")
INFO: Testing QML
QQmlApplicationEngine failed to load component
file:///home/ufechner/.julia/v0.4/QML/test/main.qml:1 module "QtQuick" version 2.5 is not installed

Any idea?

Bart Janssens

unread,
Mar 16, 2016, 5:45:16 PM3/16/16
to julia-users
This could be either a missing Qt package, or the version is not recent enough. I don't use any recent QML commands, so it's safe to use QtQuick 2.0 and Controls and Layouts version 1.0. I have updated the main.qml in the repo.

If you pass just QString("main.qml") as argument to QQmlApplicationEngine it will look in the current working directory. You should also be able to pass an absolute path. By default, the test runs in the test directory of the package, so the test looks for .julia/v0.4/QML/test/main.qml. maybe your .juliarc.jl did an override on that.

Cheers,

Bart

Uwe Fechner

unread,
Mar 16, 2016, 10:50:08 PM3/16/16
to julia-users
Great, now it is working!

I will do some more testing tomorrow.

Uwe
Reply all
Reply to author
Forward
0 new messages