QML support for Go

1,706 views
Skip to first unread message

Gustavo Niemeyer

unread,
Sep 18, 2013, 5:33:07 PM9/18/13
to golan...@googlegroups.com
Greetings,

If you haven't seen it on G+ or elsewhere, I've been working on QML
support for Go, and the code is now available if you want to have a
look at the alpha release.

Here is a quick demo:

http://youtu.be/FVQlMrPa7lI

Details for the release at:

http://goo.gl/7lbZWj


gustavo @ http://niemeyer.net

chai2010

unread,
Sep 18, 2013, 7:47:17 PM9/18/13
to Gustavo Niemeyer, golang-nuts
great. thanks for doing this.


2013/9/19 Gustavo Niemeyer <gus...@niemeyer.net>

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
chaishushan
http://my.oschina.net/chai2010

George McBay

unread,
Sep 18, 2013, 8:29:18 PM9/18/13
to golan...@googlegroups.com
This is really nice! Good work!

I had a much messier version of something like this that I've been working on off and on (mostly off) for a couple of months as part of a random side project, but since I started working on it a while ago it didn't use the newer 1.2 C++ support so it had this large hacky export "C" layer around it.  This solution is much cleaner (both in terms of the Go code and the app executable build process) and complete (cross-logging support, etc, which I never got to) even in its current "alpha" state.

I think this is the most practical approach to creating good cross-platform UIs for Go apps as it lets Qt do all the heavy platform specific lifting while not creating a giant mess of a wrapper on top of the entire Qt API.

Gerard

unread,
Sep 18, 2013, 11:11:57 PM9/18/13
to golan...@googlegroups.com
Thanks for the great work! The demo looks awesome.

Daniel Ortiz Pereira da Silva

unread,
Sep 19, 2013, 1:00:07 PM9/19/13
to golan...@googlegroups.com
Windows support ?

Gustavo Niemeyer

unread,
Sep 19, 2013, 2:47:58 PM9/19/13
to Daniel Ortiz Pereira da Silva, golan...@googlegroups.com
Haven't tried, but in theory it should work fine.
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--

gustavo @ http://niemeyer.net

Yunge

unread,
Sep 21, 2013, 11:37:05 AM9/21/13
to golan...@googlegroups.com
So impressive!

Ondekoza

unread,
Nov 20, 2013, 8:05:15 PM11/20/13
to golan...@googlegroups.com
On Windows the go get fails (while all the mentioned requirements are satisfied) with

# pkg-config --cflags Qt5Core Qt5Widgets Qt5Quick glib-2.0
exec: "pkg-config": executable file not found in %PATH%

I am aware of the purpose of the pkg-config tool. Which is the endorsed solution for Windows?

Gustavo Niemeyer

unread,
Nov 20, 2013, 9:53:24 PM11/20/13
to Ondekoza, golan...@googlegroups.com
My understanding is that using pkg-config itself is the actual
solution, and people have been able to install it from somewhere.

I'm sorry for not being of much help there. Unless a Windows developer
that wants to contribute to the project regularly to
document/test/debug/fix issues joins us, I'll have to mark the
platform as unsupported for the time being. I'm just not able to
respond to these issues with the deserved level of care.

George McBay

unread,
Nov 21, 2013, 9:10:06 PM11/21/13
to golan...@googlegroups.com
The quick and dirty way to make it work on windows is just drop the pkg-config line in bridge.go in the qml package and replace it with absolute paths to the various required include and lib dirs.

The #cgo block in my local bridge.go looks like this:

// #cgo CPPFLAGS: -I./cpp -IC:/Qt/Qt-5.1.1-x86_64-opengl/include -IC:/Qt/Qt-5.1.1-x86_64-opengl/include/QtWidgets -IC:/Qt/Qt-5.1.1-x86_64-opengl/include/QtQuick -IC:/Qt/Qt-5.1.1-x86_64-opengl/include/QtQml -IC:/Qt/Qt-5.1.1-x86_64-opengl/include/QtCore -IC:/Qt/Qt-5.1.1-x86_64-opengl/include/QtCore/5.1.1/QtCore
// #cgo CXXFLAGS: -std=c++11 -pedantic-errors -Wall -fno-strict-aliasing
// #cgo LDFLAGS: -lstdc++ -LC:/Qt/Qt-5.1.1-x86_64-opengl/lib -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Declarative -lQt5Qml -lQt5Quick

You'll want to search and replace "C:/Qt/Qt-5.1.1-x86_64-opengl/" with the local absolute path to your installed qtdir.  

Ondekoza

unread,
Nov 21, 2013, 10:13:08 PM11/21/13
to golan...@googlegroups.com
Thanks. I'll try that.

Gour

unread,
May 28, 2014, 8:40:19 AM5/28/14
to golan...@googlegroups.com
George McBay <george...@gmail.com>
writes:

> I think this is the most practical approach to creating good cross-platform
> UIs for Go apps as it lets Qt do all the heavy platform specific lifting
> while not creating a giant mess of a wrapper on top of the entire Qt API.

I've become interested in learning Go after I discovered Hugo
(http://hugo.spf13.com/) recently, but now after finding out about QML
bindings I'm thinking whether I could possibly extend my usage of Go to
the project of writing multi-platform desktop app with Linux as native
platform?

I want to avoid using C(++) and prefer having some type-safety in the
language as well as decent performance.

Many potential languages (e.g. OCaml, Ada, D, Nimrod...) lack decent
non-gtk bindings and another candidate (Rust) has bindings for Rust, but
Go's syntax is more pleasante to take a look for me.

However, I wonder if QML (without straight QtGUI) in Qt-5.x is
good-enough for writing desktop apps?


Sincerely,
Gour

p.s. @Gustavo: What do you think about subscribing go-qml to Gmane?

--
Therefore, without being attached to the fruits of activities,
one should act as a matter of duty, for by working without
attachment one attains the Supreme.

Jackie

unread,
May 28, 2014, 5:49:48 PM5/28/14
to golan...@googlegroups.com
try this;

Gustavo Niemeyer

unread,
May 29, 2014, 4:19:19 AM5/29/14
to Gour, golan...@googlegroups.com
On Wed, May 28, 2014 at 2:32 PM, Gour <go...@atmarama.net> wrote:
> However, I wonder if QML (without straight QtGUI) in Qt-5.x is
> good-enough for writing desktop apps?

It certainly is.

> p.s. @Gustavo: What do you think about subscribing go-qml to Gmane?

That'd be fine by me, but we already have the history via Google
Groups. Is there any advantage of using Gmane as well?


gustavo @ http://niemeyer.net

Gour

unread,
May 29, 2014, 5:17:53 AM5/29/14
to golan...@googlegroups.com
Gustavo Niemeyer <gus...@niemeyer.net>
writes:

> It certainly is.

Great!!

> That'd be fine by me, but we already have the history via Google
> Groups.

Well, Gmane subscription does not exclude Google groups.

> Is there any advantage of using Gmane as well?

(to me) main adavantages is that having Gmane subscription means I can
take advantage of my news/mail reader (Gnus), there is no need to create
extra rule to filter messages in some separate folder in order not to
clutter my INBOX, there is automatic archive available and if the group
at Gmane is set to 0posting allowed', it's very easy to follow/post to
the group without any need to (un)subscribe - one just has to reply to
Gmane authorization message (once per email address) and that's all!!

Moreover, there is no spam coming from Gmane posters 'cause the server
us using, IIRC, TMDA mechanism.

On top of that, Google Groups web ui simply sucks, imho. ;)

Finally, check this: http://dir.gmane.org/gmane.comp.lang.go.general -
iow. I'm posting to this via Gmane. ;)


Sincerely,
Gour

--

Gustavo Niemeyer

unread,
May 29, 2014, 5:53:11 AM5/29/14
to Gour, golan...@googlegroups.com
Sounds good. I've sent the request for inclusion.
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Gour

unread,
May 29, 2014, 6:02:22 AM5/29/14
to golan...@googlegroups.com
Gustavo Niemeyer <gus...@niemeyer.net>
writes:

> Sounds good. I've sent the request for inclusion.

Thanks a lot. In the meantime I'll regularly subscribe having problems
with the build on my Debian (Sid) box.


Sincerely,
Gour

--

Reply all
Reply to author
Forward
0 new messages