11 ms·
A Book about Qt5
- pknopf 8y agoThis page mentions using Python. I also went to mention that you can now use .NET/C# with QML as well. https://github.com/qmlnet/qmlnet https://github.com/qmlnet/qmlnet PS: I'm the author.
- Waterluvian 8y agoHi author! When I used Qt4 years ago, I ran into a lot of issues regarding segfaults and generally issues with the underlying C++ objects. Admittedly this was largely my fault, but I did find that I had to worry about the underlying implementation a lot and not think idomatically in Python as much. Have things improved?
- pknopf 8y agoI haven't used Qt4, but I haven't had issue with segfaults and pure C++/QML integration. When it comes to the .NET integration, you don't have to worry about the .NET GC or the JavaScript GC. There are extensive unit tests to ensure that the two garbage collectors work together. I would actually say it's impossible to make QmlNet segfault.
- toyg 8y agoRecent PyQt segfaults a bit less than it used to do in Qt4-times. I believe Riverbank made some efforts to avoid the most common problems with object lifecycle. This said, underneath C++ and CPython have very different ideas about lifecycle, and Qt is very complex, so the occasional issue has to be expected. I cannot speak for pyside/“qt for python”, but that project has always lagged behind PyQt, so it’s unlikely to be much better.
- colatkinson 8y agoMy company uses Qt5 via Python fairly extensively. While it's great almost all the time, we've definitely encountered a few weird issues with segfaults, especially on Windows. Some our fault, some due to weird Qt/graphics driver interactions.
- pfranz 8y agoThe specifics get a bit annoying and pedantic. I'm guessing you were dealing with Qt4, PyQt, and Python2? PyQt was a separate thing written by Riverbank Computing (sip was the binding interface). The bummers were it wasn't open source and had separate licensing. In 2009, the Qt people (Nokia at the time) released PySide. Shiboken is the new binding interface. It was mostly compatible with PyQt, open source, better license, and was more idiomatic with Python (Python unicode strings instead of QString, more decorators on functions instead of having to call specific functions in a specific way). Qt5 was released in 2012. A lot of the user-facing focus was on QML. QtWidgets (the only part I'm familiar with) are now considered "feature complete." That means they're not deprecated, but not getting any new development. PySide2 is PySide with Qt5 support. That took awhile (especially to get Python2 support) and PySide2 was later branded "Qt for Python" even though the imports are still "pyside2." During this time many people transitioned to Python3. Sorry to throw out so many things. A lot has changed, not all of it might be relevant to you, but I figured I'd mention them so you have a reference point if you want to jump back in or look more into what has changed. Now to actually address your question. Pyside2 is a pretty big step towards making Qt more idiomatic to Python. I can't speak definitively on the rest of the transitions, but I don't think much has changed. Maybe QML and Python3 are more idiomatic? After using them for a decade, I feel like idiomatic Python just doesn't have the constructs needed for an event driven gui so it has to lean on C++ and other things Qt built. Or Qt integration was done so long ago, it wasn't built around newer Python things like asyncio. I also can't speak too much to Python3 since my day job still uses Python2/PySide2/Qt5, but I've been looking at the new Python3 packages for years. Unfortunately, I feel like a lot of the async stuff added to Python isn't as terse and elegant as seeing something written in C ported to Python. Maybe I need to recalibrate what I think of as "Pythonic" when I get to use Python3 day-to-day? As an anecdote of Python lacking necessary constructs, I've stumbled on co-workers using parts of QtCore outside of any GUI because it was the best library they had handy. I wish I could remember some of the use-cases, though.
- toyg 8y agoPyQt has always been open-source - it’s dual-licensed under GPL 2 and commercial. What you meant to write probably was “PyQt is not free to use in closed-source applications”.
- sjvpv 8y agoYou mean QML? It's weird to see all of the C++ API reduced to a chapter. I've used Qt for years and QWidgets from C++ is all I've used.
- hellofunk 8y agoQWidgets are not under active development, and the future is QML. QWidgets will likely only receive maintenance fixes going forward. Time to join the future!
- 781 8y agoQML is just a teaser. Once you taste it you'll want the real thing and you'll move to Electron.
- discreteevent 8y agoI had the opposite experience. Each to their own.
- justinclift 8y agoThe browser-application-pretending-to-be-a-desktop-application things I've seen don't handle multiple windows correctly, and most of them have problems with multi-key custom keyboard+mouse actions. :( Does Electron handle those scenarios well?
- Longhanks 8y agoAccording to the 2019 roadmap, QWidgets is very much not dead and will get new widgets this year: https://blog.qt.io/blog/2019/02/22/qt-roadmap-2019/ https://blog.qt.io/blog/2019/02/22/qt-roadmap-2019/ My personal opinion of QML is also contradictional: QML on the desktop to me just feels like a glorified Electron, resizing windows is choppy, controls feel slightly "off", the "single page" approach just feels like it misses the platform's defining features (dialogs and multiple windows). Best example is KDE Discover. But I'd like to be proven wrong, I'd love to hear of QML desktop software that is genuinely high quality, but I haven't heard of any.
- glenrivard 8y agoMuch prefer Flutter.
- cheez 8y agoQML is fantastic. I use it for a commercial application of mine. Main difficulty is finding someone to implement designs but I can do that myself if push comes to shove as I don't need to do a full redesign every 6 months.
- sickcodebruh 8y agoI know nothing about Qt beyond the most basic description but I’m interested in exploring it as an alternative to Electron. I see lots of debate in the comments here but limited context to help me understand what is being debated. Is this book for me? What background should I, a total beginner, be aware of before I dive in?
- psyclobe 8y agoQt is nice but takes some effort to make it do what you want it to do, just like any other c++ project. Once you get the hang of it though it can do just about anything, on any platform. At my previous job we had deployed a single code base QML ui interface across mac/windows/linux/android/ios. The mere fact you can do that and have it not look like junk everywhere is pretty cool.
- sonnyblarney 8y agoQt is a very comprehensive system for apps developed mostly in C++. QML which is like a declarative Javascript, can be used to do quite a lot, but you'll almost certainly need to do some C++ customization in addition to the initial basic 'main app' process which requires C++ as well. Many of their customers use it for display/kiosk things (think 'in car display') so it has a lot of hyper-specific attributes which can make it seem a little difficult. The build process is ultimately C++ based (ie make, with their own layer called 'qmake') and so you're going to have to be familiar with that. In our experience it's quite slow moving compared to JS/CSS/HTML obviously, and performance gains are very situationally dependant.
- sickcodebruh 8y agoThank you! That’s helpful. Since you’re comparing it to JS/CSS/HTML, does this mean you moved from that to Qt? If so, do you think it was a worthwhile move? When you say many of _their_ customers, who is they? Qt or the people responsible for QML?
- sonnyblarney 8y agoI've used both on projects. HTML5 is comparable really when used in combination with Electron for example, i.e. to make an installable app. Surely you're aware of the limitations and challenges of HTML5, i.e. you can move quickly, but it's full of quirks. Electron is a little heavy. Qt I would use if performance was a concern, i.e. there were imaging algorithms, or if the hardware platform were non-standard. Yes, Qt's customers are auto-companies etc.. Qt is complex and it's a kind of a big step, and it's in C++ which is always a lot slower to move in, however it is powerful, there's really no other comparable.
- TheCabin 8y agoMaybe I should read the book, but somebody probably knows: Is there a set a default widgets when using QML?
- iBelieve 8y agoYes - QtQuick Controls 2. It is discussed in the book at https://qmlbook.github.io/ch06-controls/controls.html https://qmlbook.github.io/ch06-controls/controls.html and has official documentation at https://doc.qt.io/qt-5/qtquickcontrols-index.html https://doc.qt.io/qt-5/qtquickcontrols-index.html
- ognarb 8y agoThere is qt quick controls. And some third party library like kirigami from kde.
- mattigames 8y agoI still remember the amount of pain I went with trying to use Qt5 on python, the compile errors, the compile times, the differences between what QtDesigner showed and the actual output, made me appreciate CSS and SASS a lot more.
- rolleiflex 8y agoSame here. I designed and built the first version of Aether with Qt5 via Python. It was a miserable experience where the only way to solve certain things were to insert non-meaningful text into certain magic Python fields which would go and compile in C++. Plus a few hundred iterations of getting the magic incantations to work in a consistent manner. For the second version — I've moved to Electron for UI and Go binaries for actual heavy lifting. At least that one is a known pain you can Google for.
- qwerty456127 8y agoIndeed lack of a good (Tkinter just doesn't offer all the necessary widgets, looks and feels clumsy) modern pythonic GUI toolkit seems the biggest problem of Python to me. Nevertheless I'm surprised to read you had to compile anything (if you don't mean using pyuic5 to generate Python classes from QtDesigner XML files) and deal with C++ while using Qt5 with Python.
- pjmlp 8y agoThey are now investing into Python as official supported language. https://www.qt.io/qt-for-python https://www.qt.io/qt-for-python
- mk89 8y agoWell, it was about time. Pyside is a quite old project that for a while almost seemed to have fallen into oblivion. Glad to see that they are finally using it as official binding tool.
- fbender 8y ago
- dang 8y agoDiscussed in 2016: https://news.ycombinator.com/item?id=10940484 https://news.ycombinator.com/item?id=10940484
- bgorman 8y agoI don't know Qt, but I have a cursory understanding of the DOM, to the point that I can make fully featured "SPA" applications from scratch. Most of my background has been in systems programming. Would learning QT enable me to make applications faster? I have only been exposed to UI programming and through React via Clojurescript and ReasonML and Angular 6/AngularJS
- beisner 8y agoFrom my (admittedly limited) experience with Qt, it’s an extremely powerful framework with a somewhat-steep learning curve. Dead-simple apps are dead-simple, but there’s a lot of Qt-specific stuff (I.e. QML, control paradigm, extensive libraries, etc.) that you need to learn in order to get the full value out of it. That said, it’s still a great cross-platform option, and the fact that it has bindings in most popular languages and is extremely performant (if you write it properly....) means that it’s probably worthwhile if you need to make a desktop application.
- ausjke 8y agoI'm debating between Pyside2 vs Electron these days, the latter will need some memory for sure, but I don't need learn the QT apis at least
- shaan7 8y agoFor folks who are new to Qt5 and are wondering how an app looks in production, we have a screenshot at https://www.sostronk.com/app https://www.sostronk.com/app We released SoStronk's desktop app using Qt5 in 2014 and its going great today as well. Having had ~5 years development experience with this, I'll be happy to answer any questions :)
- lnsru 8y agoNo screenshot on mobile. Where is it?
- shaan7 8y agoOops, I'll check whats up with that. Meanwhile https://www.sostronk.com/assets/tilt-ca31719ca134cbaf.png https://www.sostronk.com/assets/tilt-ca31719ca134cbaf.png
- omegote 8y agoThat looks amazing. Do you use Qml or standard QWidgets?
- shaan7 8y agoQML with QtQuick Controls 2
- shaan7 8y agoAnother good example is Blizzard's Battle.net app https://www.blizzard.com/en-us/apps/battle.net/desktop https://www.blizzard.com/en-us/apps/battle.net/desktop
- justinclift 8y agoThe Qt Showroom may be useful as well: https://showroom.qt.io https://showroom.qt.io Seems to be based on user submissions.
- wjoe 8y agoThat looks great, but very different to what I've seen from playing around a bit with Qt. Are you using some open source theme or components there, or is it very custom built? I felt that Qt Quick Controls 2 felt far too mobile focused when I tried it out, and looked/felt very out of place in a desktop application, but I guess if you're customizing it heavily then that's less of an issue. I notice you're only providing a Windows download despite Qt being cross platform. Are there any blockers or issues in building the same app for Mac/Linux, or is that just not something you've looked at. I guess the latter since it's for a game, but just interested since I've seen a lot of comments in the past about difficulties making Qt apps run consistently across different platforms. Are you using QML and JavaScript for all of the application code, or just using that for the UI and handling the main logic from C++ or other language bindings? Any thoughts on the Qt/QML approach compared to Electron?
- jyriand 8y agoI have been thinking about creating a desktop app for a while now. Problem is I can't decide which framework to use. Ideally I would like to use Common Lisp, but McCLIM looks like it's from the eighties, there's also qtools and CommonQT that make it possible to use Qt in Common Lisp, but somehow I'm afraid to develop myself into corner with these tools. Could also use clojure and "seesaw", but again -- it's like I'm handicapping myself here. I could use Racket and it's GUI library, but Racket is marketed as a language for creating languages, so I'll skip that. I guess I still need to use Java 8 with JavaFX. I wish there was a lisp dialect just for developing desktop applications.
- MarvelousWololo 8y agoHm I'm in the exact situation and I'm total beginner on desktop apps. I've been looking into Flutter for desktop but it isn't stable yet. If you ever come to a conclusion would you mind to share it? Thanks.
- SheinH 8y agoJavaFX is a great choice for beginners. Whatever app you make, anybody can run so long as the have the JRE installed.
- hanniabu 8y ago> as the have the JRE installed. Does this come packed with most platforms (Mac, Linux, Windows)?
- izacus 8y agoNo, but nothing else does either - you'll need to ship runtime environment in any case. And packing JRE is more cross-platform tested than most other solutions.
- MarvelousWololo 8y agoIsn't it heavy and slow though? At least that's what I hear. I use android studio in a beefy macbook pro from time to time and it's slow as hell.
- sevensor 8y agoDespite the focus on QML, the Widgets are very easy to work with -- mature, well thought out, cross-platform. I highly recommend PyQt for desktop application development.
- rms25 8y agoI really like QML but the licensing is kinda tough for hobbyists if you wanna do stuff outside of their opensource license. They used to have a cheaper license