13 ms·
Qt binding for Go with support for all major operating systems
- xmichael99 10y agoWhere is the proper useful C# binding....
- xmichael99 10y agoPlease, please where is a proper C# binding?
- pekim 10y agoI've been using this library for a couple of weeks, and so far I have been very impressed. It's relatively easy to use, and seems to be pretty comprehensive in the amount of the Qt API that it supports. I raised two small issues, and both were addressed quickly by the author. In one case incredibly quickly.
- cjslep 10y agoSo this is more comprehensive than the qml binding library?[0] [0]https://github.com/go-qml/qml https://github.com/go-qml/qml
- c8g 10y agoThe Author said about go-qml and this binding in reddit[0] [0]https://m.reddit.com/r/golang/comments/585rvs/comment/d8xtrez https://m.reddit.com/r/golang/comments/585rvs/comment/d8xtre...
- Matthias247 10y agoIt for sure is. However QML might also be all you are interested in, since Go already has a very good standard library which covers lots of things. Then the remaining question is which of those Go QML wrappers is of a higher quality and easier to work with.
- wilonth 10y agogo-qml/qml is just a tiny wrapper around the QML API, which is nothing compared to this. This library covers the whole entire Qt framework (Qt Widgets libraries + QML + everything else).
- bobwaycott 10y agoWhy do the iOS screenshots look nothing like iOS? https://github.com/therecipe/qt/blob/master/internal/screenshots/ios_portrait.png https://github.com/therecipe/qt/blob/master/internal/screens...
- bluehazed 10y agoIt's the Qt framework, not iOS's UI framework.
- maemre 10y agoIt definitely looks like Qt but I am surprised that Qt is not using any native controls on iOS. It tries to use native controls or at least a native look and feel if possible (it does so on Windows and macOS at least). On the other hand, I don't know anything about mobile app development and apis that iOS gives you so I cannot tell whether such a thing is possible in iOS at all.
- bluehazed 10y agoHmm. Entirely possible certain APIs aren't available in a certain way. I wonder if it's possible to "skin" it, in a fashion.
- bluehazed 10y agoMight just be that they didn't do that work yet but it is trivial and just requires some skinning that hasn't been done yet?
- distances 10y agoTwo points: a) Qt doesn't use native controls on any platforms (though for half of desktop Linuxes Qt is the native toolkit). Qt has its own controls that are styled to look like native. b) The screenshot shows Qt widgets. This is not the intended way to do Qt on mobile platforms, and thus no native styling is provided. QML is the official way to do mobile apps with Qt.
- 10y ago
- blowski 10y agoPlease change the title - the long string breaks the HN layout on my phone.
- nardi 10y agoPlease, I beg of you, do not create an iOS app using this library. Look at that screenshot: https://github.com/therecipe/qt/blob/master/internal/screenshots/ios_portrait.png https://github.com/therecipe/qt/blob/master/internal/screens... It looks like a tiny Windows 95 on your phone. Tap targets way too small.
- shmerl 10y agoI guess no one provided needed Qt Quick Components?
- kbroulik 10y agoSo, you're saying [1] and [2] look like Windows 95? They're built with Qt. [1] https://itunes.apple.com/de/app/auto-motor-und-sport/id366444729 https://itunes.apple.com/de/app/auto-motor-und-sport/id36644... [2] https://itunes.apple.com/us/app/mens-health-fitness-trainer/id542656239 https://itunes.apple.com/us/app/mens-health-fitness-trainer/...
- zerr 10y agoHonestly speaking, I find "Win95" look and controls much more intuitive and easy to use.
- abrkn 10y agoThe glorious days before flat ui
- noir_lord 10y agoFlat can be fine with shadows (though if it has shadows is it flat?) and other hints but yes I think the desktop UI in particular reached it's peak with Win2k, everything since has been different but not better. These days I use XFCE with http://www.noobslab.com/2016/03/vivacious-colors-gtk-theme-suite.html http://www.noobslab.com/2016/03/vivacious-colors-gtk-theme-s... and it's nice.
- 10y ago
- nickcw 10y agoI love that the author provides docker images for cross compilation. Cross compilation environments are such a pain to setup and maintain - having docker images with all that stuff in is a major step forward. Next time I want to build a desktop app I'll have a go with this for definite.
- herge 10y agoDocker will only let you cross-compile to OSes with the same kernel, which is relatively limited. A full set of say vagrant files would be slower, but a lot more polyvalent (but even then it would not let you, say, compile a windows binary from linux).
- detaro 10y agoYou can cross-compile to completely different environments. It just can be tricky to set up, so prepared docker images with e.g. the toolchain to build a Windows executable on Linux are great to have, and what is provided here.
- cryptarch 10y agoI think it's a nice idea in theory to provide cross-compilation support by means of emulating all possible target architectures on the compiling machine. Then I remember that I'd be managing a custom heterogenous compute cluster just to compile some code.
- friendzis 10y agoSerious question: Once I have been building Qt Widgets application in Python with PySide bindings. I needed to do some simple processing in several SLOTs and decided to use lambdas as an easy replacement. Kids, do not even think about attempting to do this at home, seriously. I have run into some extremely evasive random crashes and stuff. I did not dig to the bottom of the issue, although my guess is that Python lambdas are executed in main (constructing) thread context and that causes race conditions. My question: how do Golang's goroutines interact with native threads spawned by Qt?
- ffjffsfr 10y agoI have some experience building PyQt apps and can confirm random crashes (segfaults, sigaborts and such). I suspect this has nothing to do with lambdas. It may likely be something happening between Python and QT - remember that all things happening in QT/C++ world are invisible to Python. For example if your Python routine returns None (as many Python methods, functions do) instead of some other object that is expected by C++ (say QNetworkRequest) it may crash and die without any traceback. I spend hours on things like this - QT method must return something but in some cases was not returning expected object and whole thing was crashing. Python being Python doesn't care about return types, there is no Python traceback, you're left in the dark groping, browsing codebase trying to find what might get wrong, no debugger will help you. Working with QT bindings is very difficult. Debuging things is not easy. I'm not sure if using bindings is worth it. I suspect doing things in plain C++ QT might be easier to debug and maintain.
- blub 10y agoIn C++ one gets a compilation error if the wrong type is returned from a function. Qt is generally type safe, but it uses quite a lot of pointer types and also a rather unusual for C++ parent-child resource cleanup rule for QObjects (e.g. all widgets). When something does crash, C++ doesn't offer any tracebacks, but if one has a core dump or can reproduce the crash under a debugger, a traceback can be easily obtained in the majority of cases.
- 10y ago
- nisdec 10y agoCould someone please enlighten me why an installation would need 8gb of free ram?
- oblio 10y agoIf it's building everything (including Qt), Qt includes Webkit. I imagine that's a lot of C++ code to build.
- creshal 10y agoQtWebkit and QWebEngine, which uses Blink(/CEF). 8GB RAM is rather optimistic.
- therecipe 10y agoauthor here; It's needed by `go install` to provide pre-compiled packages, which will then speedup the compilation of your applications down to 10sec. But you can also use the STUB setting, before running the setup and then use the binding with only 1gb ram as well. (the necessary c++ code will be compiled later with qtdeploy) edit: can't comment any further currently, I will try to answer everything once I'm unblocked.
- tachion 10y agoSadly, FreeBSD is not included in the supported OS list.
- therecipe 10y agoauthor here; Didn't know it was supported by Qt, I will put it on my TODO list ;) edit: can't comment any further currently, I will try to answer everything once I'm unblocked.
- deleted 10y ago[deleted]
- oblio 10y agoNow if only someone did the same thing for .NET Core. Ideally someone who would want to build a business on that :)
- elcct 10y agoYou mean Go bindings for .NET Core?
- oblio 10y ago.NET Core bindings for Qt. .NET Core doesn't have any UI toolkit right now. There are several efforts but they're mostly hobbyist ones and seem to lack funding or major development power, unfortunately.
- elcct 10y agoWhat about WPF?
- Nullabillity 10y agoRequires DirectX, so it won't run outside Windows.
- 0xCMP 10y agoIt's not designed to do cross platform UIs and QT already is. It's be easier to bind QT to .NET than make WPF cross platform.
- pjmlp 10y agoI would rather use XAML than JavaScript dialects
- weberc2 10y agoI had a Windows Forms UI running on my Mac 6ish months ago (when I was kicking the tires on .Net core).
- MayeulC 10y agoI am wondering if there is something similar for Rust. Does anyone have some information on this?
- deutronium 10y agoNot Qt, but I'm using https://github.com/gtk-rs/ https://github.com/gtk-rs/ with Rust, which is pretty cool, I've developed the GUI using Glade, which I load via Rust. I'm also using CSS, to style the interface.
- weberc2 10y agoUnfortunately GTK itself is pretty bad, and it constantly has breaking changes. Hopefully things are improving.
- oever 10y agohttps://github.com/cyndis/qmlrs https://github.com/cyndis/qmlrs is not complete and stalled but usable. It uses Rust macros instead of moc.
- dharma1 10y agoDoes this support QML/Qt Quick Controls 2?
- Siecje 10y agoIs there an example of using data from Go in the application?
- therecipe 10y agoauthor here; Take a look inside the `internal/examples` subfolder. There are several examples. edit: can't comment any further currently, I will try to answer everything once I'm unblocked.
- johnhattan 10y agoQuestion. Does QT still have a licensing problem for closed-source apps on mobile platforms? Last I saw, QT's GPL/LGPL license required you to open-source the code that was statically linked to it. That wasn't much of a problem for desktop platforms, as you could just package up all of QT into its own QT.DLL (or the equivalent) and link to it dynamically. But this isn't allowed on stuff like iOS, so you were required to buy a license for those.
- codys 10y agoOnly parts (non-core) of QT are GPL, most are LGPL And it's a bit of a misconception that LGPL requires statically linked things to be open sourced: in that area it only requires that the LGPL components be replaceable (and the source for the LGPL components be available). In the context of static linking, that can be done by releasing pre-link binaries (object files) with instructions for linking them. Of course, that's likely more work than just making the source available under a proprietary license (ie: provide source code so LGPL components can be replaced). If you're using Qt GPL components, then yes, you'll need to open source your application (or pay for a Qt License)
- therecipe 10y agoauthor here; IANAL but I think for iOS it's still required to either open-source your code under GPL or to buy a commercial license as you said. But IIRC there is work being done to bring dynamic linking to iOS as well, since apple allowed it with iOS 8 or so. edit: can't comment any further currently, I will try to answer everything once I'm unblocked.
- Nullabillity 10y agoThat's an iOS (and Android) issue, not a QT issue.
- amyjess 10y agoQt itself is LGPL now, so it no longer requires you to open-source code linked to it. Some of the language bindings that aren't maintained by Digia are still GPL, though. An example of this is PyQt, and the PyQt team's intransigence on the GPL is why PySide exists.
- amelius 10y agoDoes Qt have something like React?
- hellofunk 10y agoQML does provide an FRP-like methodology, which is not exactly like React but in the same universe of UI techniques.
- zemo 10y agoI wish the author success. Many UI libraries for Go have been made and abandoned. It would be a joy to see one succeed.
- CorvusCrypto 10y agowas thinking this also. The language seems very well suited to GUI applications based on its internals and I would love to see what comes of it in this regard. moar bindings pls
- therecipe 10y agoauthor here; Thank you :)
- StavrosK 10y agoNot only a joy, it would be the best way we currently have to make desktop applications. Currently the easiest alternative is JS+Electron, but that's just horrible because of all the waste of resources. Python is hard to package, so something statically compiled would be great. I would prefer Rust for this (or, well, I would prefer Python with a better packaging story), but Go is much better than the alternatives too.
- jscheel 10y agoThis is awesome. I was really bummed about the state of QT support in golang. I played with the go-qml project, but it wasn;t everything I needed. This looks amazing.
- dekhn 10y agoDoes this library support making "derived classes" from QObject/QWidget? And how does that work, in Go- are they interfaces?
- therecipe 10y agoauthor here; Yes, you can create derived classes from any class that is derived from QObject. Simple anonymously subclass in Go and add your own slots/signals, as shown in the "quick/bridge" and several other examples. Then run "qtmoc" to generate the need c++ and go code. All functions usually accept interfaces and all classes have their corresponding interface, which itself inherits all the derived interfaces.
- dekhn 10y agoThat's great!
- transfire 10y agoThe code has a mind boggling LOC. e.g. https://github.com/therecipe/qt/blob/master/widgets/widgets.go https://github.com/therecipe/qt/blob/master/widgets/widgets....
- JepZ 10y agoDoes anybody know why the demo application is 52mb?!? I mean, yes, its statically linked but 52 million bytes for a window, a button and a pop-up? Shouldn't this fit into 5-10 mb? Is the whole qt lib linked into that binary?
- leo_santagada 10y agoI think you answered your own question, if it is statically linked to qt then it is statically linked to all/most of it no? I don't think qt or any gui library is divided in many small pieces like javascript libs.
- therecipe 10y agoauthor here; The size depends on your platform and the way you build it. If you used `qtdeploy` instead of `go run/build`, you should get a 2mb binary which includes Go's runtime + only the needed Qt C++ code. (A normal go binary has the size of 1.5mb or so) The rest are Qt dynamic libs, which are not all needed, depending on what you build. You can safely remove plugins and maybe whole modules. edit: and you can also compile Qt on your own to strip out ICU and other unnecessary stuff + with Qt 5.8 things will get even more lightweight.
- JepZ 10y agohehe, thx for the quick reply. Had some trouble with qtdeploy and since go build worked (and I prefer go build workflow wise) I assumed it would result in the same binary. The demo application works without any of the libs from the deploy folder, but thats probably because it uses the system libs. So cool: - Option 1: 'go build' creates one large 50mb binary - Option 2: 'qtdeploy' creates a bundle with a little more than whats required but you can remove what you dont need - Option 3: just takes the binary and let the system provide the libs Super cool would be, if that downsizing could be made automatically but since that icu stuff takes alone 24mb, that might be difficult. Anyway, great work. Spend half a day to get it working with system libs, but in the end I had to learn to just follow the tutorial and download qt again. Great job :-)
- 10y ago
- andrewfromx 10y agobig fan of the repo http://github.com/dontpanic92/wxGo/ http://github.com/dontpanic92/wxGo/ it's got everything Qt has but free
- chrisper 10y agoIs Qt not free?
- therecipe 10y agoI don't know as what you define free. But Qt is as far as I know is available under LGPL, GPL and under a commercial license. Also they co-operate with the KDE project and made sure that it will stay "free" IIRC.
- andrewfromx 10y agoCommercial licensing $79/month https://www.qt.io/licensing-comparison/ https://www.qt.io/licensing-comparison/ https://www.qt.io/faq/#_Toc_2 https://www.qt.io/faq/#_Toc_2
- kuschku 10y agoSo, dang, why is my account rate limited then? I’ve had 2 cases before where a project I participated in was presented here, and I showed up to comment, and couldn’t do so due to the rate limiting. This is not really helpful, and destroys any chance at meaningful discussion. (Also, last time you told me that rate limiting couldn’t be undone, and I should just write an email – what’s that about now?)
- dang 10y agoThere are other reasons for rate-limiting besides an account being new—if an account has posted a lot of unsubstantive or uncivil comments, for example. I doubt that I told you it couldn't be undone, because it can be undone. What I probably said was that you should email us because it isn't a good idea to go on about it here. We detached this comment from https://news.ycombinator.com/item?id=12932238 https://news.ycombinator.com/item?id=12932238 and marked it off-topic.