Settings

Theme

Qt Binding for Go with Support Desktop, Mobile and Embeddable

github.com

88 points by w3clan 6 years ago · 28 comments

Reader

derefr 6 years ago

It looks like this binding has a compile option where Qt itself is statically linked into the resulting executable. That gives this stack (Go+Qt) a very unique deployment story.

There are a lot of people (I'm looking at you, console home-brew community) who build all their little tools to go along with their projects as native GUIs, usually with C# + WinForms—not particularly because they have Windows-specific functionality, but more because they have at least some native functionality (so Electron is out) and C#+WinForms allows them to just make releases as a standalone .exe you can "just" download and run (at least on modern Windows), without needing to first install some external runtime.

This could be a good multiplatform alternative to the C#+WinForms stack, with all the same advantages. (The only con being that statically-linked Qt is pretty dang large.)

  • htfy96 6 years ago

    One thing to notice is that the open-sourced version of Qt is under GPL/LGPL, which means if you statically linked it into the executable, your application is then infected by (L)GPL.

    • kej 6 years ago

      Your application is "infected" if you use Qt without a commercial license, regardless of how you link it. It's a little harder (but still possible) to comply with the LGPL requirements when you statically link, but you are bound to those requirements either way.

      • groovebits 6 years ago

        Pretty sure having it dynamically linked is ok with the open source licence

        • kej 6 years ago

          Right, my point is that static linking is also okay with the LGPL, albeit slightly more difficult in terms of what you have to make available to end users.

      • therockhead 6 years ago

        I believe the parent post is correct and mechanism used to link effects the licence.

    • nickserv 6 years ago

      If you want to ship closed source code based on other people's hard work, then you should pay. In this case by getting a Qt commercial license.

  • jksmith 6 years ago

    Maybe, but keep in mind FreePascal/Lazarus has generally been supporting at least three of the platforms natively for several years. Complier, visual design, everything as expected from a delphi-like product. One of my FPC projects includes a desktop client with one window using multiple size controls and everything re-sizes near perfectly (know how to use panel controls). Recompiled on Linux and behavior was almost identical and no compile errors, according to expected behavior of a multi-platform toolchain. Funny enough, the client calls into a Golang rest backend I wrote. Nice, efficient solution that is easy to add additional devs to when needed.

  • MayeulC 6 years ago

    Well, you can do this with C++ and Qt as well, but as a sibling commented, you are subjected to LGPL, so your app has to be under a compatible license, or provide a way to replace the Qt part (not sure if you were to provide one such mechanism while statically linking, like SDL2 does with its dynapi[1]).

    [1]: https://hg.libsdl.org/SDL/file/default/docs/README-dynapi.md

  • longstation 6 years ago

    Would you elaborate on the size of QT? I searched and found this link ([1]) that suggests when done right, the QT part is about 20MB.

    I am asking this because sometimes people have different idea on what is accounted for being big.

    [1]: https://stackoverflow.com/questions/25426895/qt-static-build...

    Edit: grammar, link style

    • derefr 6 years ago

      20MB is still large in this case; we're talking about people who frequently use as their download host a phpBB forum with a 5MB download limit, and who usually manage to achieve sizes far less than that (usually ~150KB) because it's literally just CRUD + parsing + filesystem access + some layout XML for the dynamically-linked GUI toolkit to chew on.

      Think: "would software pirates write their little keygen GUIs in this?"

mappu 6 years ago

We ship a C++/Qt/Go application at $DAYJOB. The C++ and Go parts communicate by IPC so I would love to get down to a single language - Qt is the main reason why C++ is involved at all. A Go binding for Qt (Widgets) would seriously solve a lot of issues for us.

But this binding is LGPL, so

- we can't include it in a closed-source statically-linked Go application as-is;

- this binding plans to offer a commercial license but it isn't available yet;

- dynamic linking of a Go package (i.e. `-buildmode plugin`) is possible on Linux but not on Windows.

There's also the similar https://github.com/kitech/qt.go that works by LoadLibrary/dlsym'ing the Qt dll/so files, that has the same LGPL + no-commercial-alternative license.

  • ddevault 6 years ago

    This seems more like a feature than a bug. Shipping proprietary software to end-users is unethical. The license is working as designed.

    • tonyedgecombe 6 years ago

      Shipping proprietary software to end-users is unethical.

      The user wants to use the software, the developer wants to provide it. I'm really struggling to see what is unethical about that.

      • rudilee 6 years ago

        Maybe what he means is that it's unethical to provide software to user without access to the source code, so in case the developer go out of business the user is left with software that the user couldn't update by themselves or someone else they hired.

    • fithisux 6 years ago

      Agreed

  • jcelerier 6 years ago

    You can statically link LGPL.

api 6 years ago

This is much more basic but also considerably smaller.

https://github.com/andlabs/ui

I really wish libui had more support and momentum. It's literally the only sane cross platform UI project in existence. Everything else is not native (html5 guis), has no accessibility support (all the immediate mode ones), is ancient and ugly (wxwidgets), or is bloated (qt).

  • cryo 6 years ago

    Is andlabs/ui still maintained? The last commit is from September 2018. Personally I love Qt since it's modular and I only use (and ship) the parts needed by the application.

    It exists since 1995 and is still heavily maintained and modernized over time. I don't know any other GUI cross-platform library like that.

    • api 6 years ago

      It's maintained, but by one dev in their spare time as near as I can tell. The parent libui project is in the midst of a refactoring.

      We're considering using it for some simple client UI stuff and if we do we plan to make a donation.

      This would take a lot of work to be powerful enough for a complex rich UI, but the world needs a basic cross platform UI lib for doing simple interfaces. It's absurd for things like file sync clients and VPN clients to spin up f'ing Electron to provide a UI, but they often do.

    • fithisux 6 years ago

      This is maintained. libui is the parent project.

xeeeeeeeeeeenu 6 years ago

I'm curious whether those bindings were written entirely by hand or perhaps some generator was used.

  • donatj 6 years ago

    I was wondering the same thing. Seems like a massive undertaking by hand.

cjensen 6 years ago

The license looks like a mess. They claim their own code is LGPL, but it looks like some of their code links to GPL modules (e.g. serialbus).

To my mind, this is entirely GPL and heaven help anyone who mistakes it for LGPL.

linux2647 6 years ago

I've never seen Qt run in a web browser. It's weird but cool

_pmf_ 6 years ago

I predict that we will see a renaissance of CORBA / COM MIDL in the form of WebAPI IDL as new IPC standard, bringing interoperability back to where it was around 1995.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection