r/programming • • Dec 08 '20

Qt 6.0 Released

https://www.qt.io/blog/qt-6.0-released
664 Upvotes

229 comments sorted by

47

u/troyunrau Dec 08 '20

Qt is awesome. I use it at work all the time, via python. Looking forward to playing with new features (and breaking things).

24

u/cedear Dec 08 '20

You're probably waiting awhile for Qt 6 python.

15

u/aquaticpolarbear Dec 08 '20

I thought the python API was mainlined? Wouldn't that mean python support will release at the same time?

7

u/kakiremora Dec 09 '20

Some things won't be added back until at 6.2

6

u/xlzqwerty1 Dec 08 '20

Hopefully the bindings API doesn't have a drastic change!

2

u/MonokelPinguin Dec 08 '20

Well, the implementation changed. I doubt the API will change much, but there may be some additions, that are faster or more efficient.

3

u/McDerface Dec 09 '20

There is a tweet here that I think addresses this concern

1

u/ttt-1 Dec 09 '20

Qt for Python is coming soon for Qt 6.

5

u/tansim Dec 08 '20

may i ask how you design GUI in practice?

19

u/troyunrau Dec 08 '20

I'm old school. I do manual widget layout not using anything like .ui files or QtDesigner. I also do stupid non-standard things in python like embed the application icons as a base64 encoded string...

But it works for me, and reliably. I am mostly wrapping data processing routines into something user friendly, with wizards, configuration dialogs, a few dynamic charts and graphs. The actual hard work is mostly handled by numpy or similar. Pyqtgraph is great for plotting.

5

u/C-FOKO Dec 08 '20

Same for me, Qt and python have been very useful at work. Looking forward to working with Qt 6

1

u/[deleted] Dec 09 '20

I found depending on how basic the data analysis app is, Streamlit is insanely easy to use. . If you don't need more than buttons, sliders, graphs, tables, and data fields, this is definitely faster. It can't do everything though.

1

u/dragonatorul Dec 10 '20

How do you package the app for distribution? I only ever made a small app with a friendly UI form with 4 fields and two buttons. No more than 300 lines of code in total.

I tried to package it as an exe by various means I found online and failed in 3 attempts. The farthest I got was an exe that errored out on execution and was over 300MB in size, for 300 lines of code. In the end I just wrote a script to run it from the repo folder with the development venv.

1

u/troyunrau Dec 11 '20

So, our company installs python and a reasonably large subset of scientific packages on all our systems (PyQt/pyside, numpy, scipy, matplotlib, etc. are expected on any of our computers). This is due to our industry being scientific consulting. I can just send the py files and people run them without hassle. Nothing goes external.

97

u/AsIAm Dec 08 '20

Really happy to see new major release of Qt even though I haven’t touched it since 2015. QML/QtQuick opened my mind.

16

u/thebigslide Dec 08 '20

Great, now I have to spend 10 hours updating Gentoo workstations...

3

u/Bobbbay Dec 08 '20

Why don't you use Binary Caching on Portage?

3

u/thebigslide Dec 08 '20

I have a binary pkg distribution server but there are combos of use flags that make necessary multiple binary versions of packages.

2

u/[deleted] Dec 08 '20

FEATURES="binpkg-multi-instance"

1

u/suitable_character Dec 09 '20

Good thing that you have a fresh Gentoo installation then :)

0

u/[deleted] Dec 08 '20

[deleted]

34

u/dagmx Dec 08 '20

A significant number of applications and devices use Qt , where Electron would not be feasible.

45

u/thomasfr Dec 08 '20

Very different use cases.. Your stove or microwave graphical user interfaces aren't likely to migrate to such an over complicated UI toolkit any time soon. Qt is is among other things used for a lot of embedded user interfaces.

→ More replies (9)

29

u/whenthe_brain Dec 08 '20

KDE plasma is written in Qt and uses 500MB of RAM and virtually no CPU.

Discord is a much, much, MUCH smaller app, written in Electron, and it uses up 600 MB of RAM and 10-20% of the CPU.

10

u/[deleted] Dec 08 '20

Electron will have a hard time with remaining the most popular Javascript UI platform in the mid to long term - with all the alternatives that address it's shortcomings (bundling an entire browser, bundling Node.js runtime or both, and the obscene unwanted memory wastefulness), yet keep all of it's advantages (React/Vue like developer experience and JS), not to mention being the first choice for UI development in general.

1

u/MTXShift Dec 09 '20

What are some alternatives that don't include an entire browser or Node.js? Genuine question not making fun of anybody

3

u/[deleted] Dec 09 '20
  • https://github.com/parro-it/libui-node skips browser, but is essentially Node.js binding for libui which targets native desktop widgets (Gtk3 on Linux). Has both React and Vue wrappers so you can write your UI like you would a webapp.

  • For mobile there are VueNative/ReactNative and NativeScript providing big three frontend frameworks but instead of HTML you target native mobile OS widgets.

34

u/tigerstein Dec 08 '20

I hope that electron is just a fad and dies already.

21

u/[deleted] Dec 08 '20 edited Dec 08 '20

Electron is cancer, so you're right, it does kill. Not kill as in replace though, it just kills your memory and sucks joy out of your life, and makes the world a more bloated place where JS crapware hunts you down.

0

u/[deleted] Dec 08 '20

[deleted]

-2

u/BarMeister Dec 08 '20

Yet we do, proving that the majority of developers are spoiled, entitled people whose teams compete in who can waste more of your battery. A vicious cycle starting and ending on the dogmatic one liners surrounding performance every incompetent moron likes to shout in these discussions to justify their perfectly looking but horribly slow crapware.

-40

u/jl2352 Dec 08 '20

You may not like his opinion, but he is mostly right.

The desktop world has shifted heavily towards Electron.

39

u/flying-sheep Dec 08 '20

The “legacy” part is bullshit. There’s quite a few of them, but whenever there’s an adequate non-Electron alternative, I use that instead. I use the Electron applications:

  • Hamsket (Rambox fork)

  • VS Code

  • Discord

And the Qt applications

  • KDE Plasma and all the KDE applications I use (not even using multiple entries here)

  • Krita

  • Calibre

  • VLC

  • RStudio

  • Wireshark

  • Zoom

  • And of course all kinds of small stuff that would be complete overkill and waste of memory to do in Electron

0

u/[deleted] Dec 08 '20

[deleted]

8

u/r00x Dec 08 '20

They might not, but anecdotally, I'm inclined to agree. Seeing a whole lot of Electron/NW.js type apps these days.

24

u/Illusi Dec 08 '20 edited Dec 08 '20

And how many Qt apps do you see? On my task bar right now I have:

  • 5x GTK (Files, Firefox, Terminal, TextEditor, Deluge)

  • 3x Qt (Clementine, OpenSCAD, Cura)

  • 2x Swing (PyCharm, Netbeans)

  • 1x Electron (Tutanota)

  • 1x WxWidgets (Veracrypt)

It's harder to spot Qt since it tends to just work rather seamlessly and has system theming. Electron apps are quite recognisable as being Electron apps, so they might be more salient, but they are not as ubiquitous as Qt.

8

u/Username_RANDINT Dec 08 '20

Not that it really matters or changes the sentiment of your post, but Deluge is written in GTK. It's just that I looked at their source a lot in the past.

3

u/Illusi Dec 08 '20

Oh, seems you're right. I looked up several of the ones I didn't know. For some reason I thought Deluge was using PyQt and I didn't need to look it up.

-1

u/[deleted] Dec 08 '20

Exactly, it's obviously your experience that's universal!

-21

u/exlevan Dec 08 '20

72

u/[deleted] Dec 08 '20

Languages like C and C++ use a technology known as a linker whose purpose is to only include functionality that is used by an application into the executable. The JavaScript portion of Qt is distributed in a library of its own referred to as QtScript which is excluded from applications that don't make use of it.

This is in contrast to Electron which must include the entirety of the Chromium build in every single application distribution.

→ More replies (1)

23

u/kageurufu Dec 08 '20

I can use Qt to make a quick (and pretty) cross platform UI in a few minutes, and not include the Javascript runtime...

18

u/[deleted] Dec 08 '20 edited Dec 08 '20

I think you're overestimating the complexity of a basic javascript implementation.

→ More replies (1)
→ More replies (1)
→ More replies (6)

9

u/SonOfTheHeaven Dec 08 '20

I just recently got my (first) job as a backend dev and we use Qt. Kinda funny to see it get a new major version so soon after starting working with it. Baader-Meinhof Phenomenon in full effect I guess :)

8

u/PM_ME_UR_PICS_GIRLS Dec 08 '20

Can you tell the technology stack you're working with in your new company ? I never thought backend development and Qt framework are related in any way.

11

u/hak8or Dec 08 '20

Not OP, but I also used QT in a non GUI environment.

I needed to set up a LIN interface (common communication bus in vehicles) for a device, and needed something for it to talk to that i know works. After some googling, turns out QT has a LIN module, so I threw together a command line application that ran on Linux using said LIN module as the master, and my device as a slave.

It was very quick and painless to do, and zero resistance to not use the other QT libraries. After a while I had an absurdly feature full application which turned into a general purpose desktop LIN interface to my device and any other LIN device.

It never did gain a GUI, but I was extremely happy with it as is. Going back to the barebones std::string was very painful.

11

u/DeliciousIncident Dec 09 '20

You spell Qt weirdly.

4

u/SonOfTheHeaven Dec 08 '20 edited Dec 08 '20

Uh, the frontend is made with angular and typescript. The backend has Qt, Wt, Boost, Antlr, and I imagine other libraries I'm not even aware of.

I'm not completely certain why Qt is part of it. I imagine its because the previous application (that we still maintain and update) is made with it and a lot of the server is just ported from it. It might be kinda weird but honestly the Qt datastructures are better than the std ones so I don't really mind.

1

u/tansim Dec 08 '20

how do you hand out data from the qt backend?

2

u/SonOfTheHeaven Dec 08 '20

We use picojson for converting the request body from json and the response to json and use Wt for the actual Http stuff. It works well I think, but this part was basically finished by the time I started working on it so I don't really interact with it that much.

1

u/elder_george Dec 09 '20

At my job, we use Qt on desktop and server (mostly because our server product spun out of the desktop codebase, I guess).

We use it less and less for new UI though, moving more to the web UI displayed in embedded QWebView widgets (partly to remove pain of implementing same UI twice, partly because finding C++ UI developers is problematic - or so I've been told).

Our server stack is more or less like this:

- C++ code (using some components of Qt) - data processing, generating visualizations

- Java Spring web layer (auth, session management)

- client code (legacy C#-compiled-to-JS and increasingly Typescript).

For RPC we use either our homegrown RPC/serialization framework (that is also used by the desktop product, so we share a lot of code) for the main, monolithic service and gRPC for newer microservices (that don't share code with the desktop product).

7

u/KissMyGoat Dec 08 '20

I keep on coming back to Qt.

I am just about to use Qt for MCUs on a project and am quite looking forward to it.

19

u/tubbana Dec 08 '20 edited May 02 '25

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

25

u/BCMM Dec 08 '20

What's wrong with LGPL?

0

u/[deleted] Dec 08 '20

[deleted]

27

u/DeliciousIncident Dec 08 '20

Doesn't have to be open source, you can use Qt under LGPL in a totally closed source commercial application for free. That's what LGPL allows for, after all.

16

u/tesfabpel Dec 08 '20

that's true but in the specific case of embedded devices you can't use LGPL v3 unless you allow the user to reflash the device or to edit the files (the LGPLv3 says that you must give a way to swap the library with another version, either by replacing the DLL or by relinking .o files)...

11

u/BCMM Dec 08 '20

OK, I didn't realise they're using v3. That actually is a potential problem for a certain specific subset of users.

It's still a far cry from it being totally non-viable for all small companies.

3

u/MonokelPinguin Dec 08 '20

Well, they probably referred to the paid license being bad for small companies. It is simply far too expensive. It would be nice, if there was a cheaper option for small companies.

3

u/Munbi Dec 08 '20

That's my understanding and what I tell/suggest to clients. But a couple of my clients had done some legal investigation and come to the conclusion that industrial appliances when sold to business/professionals are exempt from those GPL3/LGPL3 clauses.

AFAIK this interpretation as never been challenged in any court here in Europe.

1

u/merlinsbeers Dec 09 '20

Interesting, because those situations are most likely to be where someone would have the knowledge and need to mod the library. Consumer toys, not so much.

2

u/nemec Dec 09 '20

Not seeing the problem. It's the user's device once they buy it, no? Hell, if they brick it while fucking with the files then maybe you can make another sale.

0

u/[deleted] Dec 09 '20

[deleted]

1

u/ajr901 Dec 09 '20

Sure, when it isn't a microwave or a fridge or something. Or do you want to include a USB port on the device with a cable you ship in the box, and a desktop and/or mobile app that allows the user to flash the software through the included port and cable?

3

u/[deleted] Dec 09 '20

I don't think the GPL says anything about physical interfaces. If you provide a JTAG connector or even just some UART pads on the board I reckon that would comply.

1

u/ajr901 Dec 09 '20

I bet you're right. I hadn't thought it fully through like that

→ More replies (1)

2

u/tradingmonk Dec 08 '20

you can't use LGPL for iOS AFAIK

3

u/AntiProtonBoy Dec 09 '20

Based on what reasoning? First time I heard this.

1

u/tubbana Dec 09 '20

And you must provide a way for clients to link against their own libraries if they wish so. Like I said, maybe it works in software projects but not for example in embedded devices with strict regulations.

1

u/AntiProtonBoy Dec 09 '20

Closed source projects can legally interoperate with LGPL libraries, as long as they are dynamically linked.

2

u/tubbana Dec 09 '20

And you must provide a way for clients to link against their own libraries if they wish so. Like I said, maybe it works in software projects but not for example in embedded devices with strict regulations.

2

u/AntiProtonBoy Dec 09 '20

maybe it works in software projects but not for example in embedded devices with strict regulations.

That would depend entirely on how the embedded binary is generated. If it's a single binary blob or executable, then it would probably violate LGPL. If it is an embedded file system, containing a loose collection of dynamic libraries, then it should be ok.

2

u/oblio- Dec 09 '20

Yours is a weird combo of a company: small company working on embedded devices for markets with strict regulations.

2

u/ttt-1 Dec 09 '20

There is the startup/small business license available: https://www.qt.io/qt-for-small-business

23

u/ReallyNeededANewName Dec 08 '20

While I can't claim to really have a horse in the race I must say it's a shame that they default to DirectX rather than Vulkan on Windows, even if just to fight against API monopolies

4

u/Harag_ Dec 08 '20

Just out of curiosity why does it matter? A cross platform framework using directx under windows shouldn't affect vulkan in any way no?

3

u/ReallyNeededANewName Dec 08 '20

It using directx won't influence vulkan, no, it's just a loss of potential influence it could've had if it'd used vulkan

1

u/jcelerier Dec 08 '20

as an user of the RHI API, in the end it's the person building the actual apps that can choose what will be used on each platform. It will also pretty much not matter at all.

16

u/[deleted] Dec 08 '20

[removed] — view removed comment

-4

u/ReallyNeededANewName Dec 08 '20

But UWP is dead?

1

u/Liorithiel Dec 08 '20

As long as there is money in supporting a platform, there will be support.

10

u/[deleted] Dec 08 '20

[removed] — view removed comment

-1

u/ReallyNeededANewName Dec 08 '20

The complete lack of support of it on the Series X and how the new WinUI 3 isn't built on it?

7

u/jcotton42 Dec 08 '20

Since when does the Series X not have UWP?

That would break all non-game apps.

5

u/undefdev Dec 08 '20

The complete lack of support of it on the Series X and how the new WinUI 3 isn't built on it?

I couldn't believe it when i read this, and a quick search confirmed my intuition.

→ More replies (3)

1

u/Sunius Dec 08 '20

What are you talking about? Anyone can deploy UWP applications for Xbox Series S/X.

1

u/ReallyNeededANewName Dec 08 '20

In back compat only, AFAIK

6

u/Sunius Dec 08 '20

What does in back compat mean? The SRA OS runs them natively.

10

u/0Camus0 Dec 08 '20

They are still forcing you to register in order to install? Back in January they removed the skip button and then removed all the offline installers.

2

u/the_gnarts Dec 08 '20

They are still forcing you to register in order to install?

What are you talking about? I’ve never had to register with anyone in order to install Qt.

3

u/asegura Dec 08 '20

You can also:

vcpkg install qt5

3

u/[deleted] Dec 08 '20

My experience with Qt is it's insanely bloated and poor integration with new C++ standard e.g. 17. The size of a final distribution including all their dlls are so big that it defeats the purpose of even using it vs python/electron/etc.

31

u/joggle1 Dec 08 '20

Did you see the release notes? Two of their big focuses with Qt 6 is better use of C++ 17 (it's one of the first things they list so must have been a major priority for them):

With Qt 6 we now require a C++17 compatible compiler enabling the use more modern C++ language constructs when developing Qt and also allows for integration points on the API side.

and having smaller packages:

Qt 6 also comes with a much smaller default package, and many of the add-ons are now distributed as separate packages through a package manager. This gives us more flexibility in adapting release schedules of add-ons to market requirements, allowing, for example, for more frequent feature releases as the core Qt packages or making them available for multiple Qt versions at the same time. In addition, we can use the package manager as a delivery channel for 3rd party content. And finally, it gives our users more flexibility as they can choose to download only what they really need.

I haven't tried Qt 6 but hope to see how much the package size has been reduced by.

→ More replies (5)

11

u/afiefh Dec 08 '20

You don't need to include all the DLLs. If you don't use QtQuick you don't include that DLL. Same for QWebEngine or any other component. If you use Qt in a CLI then you don't even need the widgets.

You might want to take a look at some examples of actual Qt apps that are quite small. Two examples that come to mind are SpeedCrunch and Qbittorrent.

5

u/asegura Dec 08 '20

Well, it's quite large. But distribution of an app based on Qt only requires the DLLs it uses. On Windows, the included program 'windeployqt' will copy the necessary dependencies next to the built executable. And with some flags you can reduce the file count a bit.

8

u/jcelerier Dec 08 '20

The size of a final distribution including all their dlls

isn't that a bit overblown ? e.g. look at RipCord, a Discord / Slack client written in Qt - it's 30 megabytes extracted. https://cancel.fm/ripcord/

In contrast the smallest electron app I have in my /opt is RememberTheMilk at 172 mb followed by Spotify at 266 mb.

1

u/nyanpasu64 Dec 10 '20

FamiTracker is a pure Win32 + static MFC app, and takes up 5 MB extracted.

1

u/jcelerier Dec 10 '20

I mean, you can do 5kb win32 MFC / cocoa / X11 apps if you want. It's when you need cross platform that it begets the need for a useful comparison. Incidentally, you can reach 5mb with statically linked Qt if you build it without the features you don't use.

-4

u/troyunrau Dec 08 '20

Depends on what you're doing. And large is relative. Cyberpunk 2077 is coming with a 43 GB launch day patch. Suddenly a few MB seems trivial.

→ More replies (2)

3

u/crazy_bout_souvlaki Dec 08 '20

I think between the 3 to 4 or 4 to 5 version I stopped the development of an application at work and switched to javascript/python . I relied heavily on a qwebwidget library which was replaced with qwebengine or something like that, to display generated reports and the change broke absolutely every template I made. I was always anxious to get to play with the goodies in every new release but it sucked rewriting or changing code to fix shit the broke due to changes.

2

u/viikk Dec 09 '20

that's why you don't update libraries in an established project unless actually necessary...

1

u/crazy_bout_souvlaki Dec 13 '20

I had to learn this the hard way ;)

0

u/JohnMcPineapple Dec 08 '20 edited Oct 08 '24

...

1

u/merlinsbeers Dec 09 '20

If you're sticking with dead OSes, is it a stretch to stick with dead libraries?

1

u/JohnMcPineapple Dec 09 '20 edited Oct 08 '24

...

0

u/[deleted] Dec 08 '20

[deleted]

11

u/[deleted] Dec 08 '20

Everyone forgets Windows 8 and 8.1 ;P

There are also enterprises that still use Windows Server 2012 and R2 that will be left out, but it's not the end of the world by any means.

0

u/[deleted] Dec 08 '20

[deleted]

2

u/zabolekar Dec 09 '20

Everyone forgets Windows 9

→ More replies (7)

1

u/shadowsjerker Dec 09 '20

Is the android development get any updates? I have problems with exporting

1

u/tending Dec 11 '20

All I want for Hanukkah are official rust bindings.

1

u/suoko Jan 05 '21

Is there a comprehensive list of all worth mentioning QT software? I have found quite a few during latest years but can't find a complete list. I found these: Freecad, WPS office, Hapitfilm, OBS, Ultimaker cura, maps.me

-8

u/zerexim Dec 08 '20

Windows 7 support?

23

u/MonokelPinguin Dec 08 '20

Nope. Qt 5.15 is the last version to support Windows 7.

3

u/[deleted] Dec 08 '20

But what level of not being supported is this? Is it "It'll probably still build and work, but we won't provide binaries or answer bug reports for it", or "It won't even build on Windows 7 anymore"?

18

u/[deleted] Dec 08 '20

There's no intentional blockage but they just aren't providing Windows 7 compatible builds (they are targeting Windows 10 SDKs). Additionally they have dropped 32-bit support.

2

u/GrecKo Dec 09 '20

The betas from the online installer worked on my Windows 7 PC. I haven't tried the release yet.

3

u/MonokelPinguin Dec 08 '20

5.15 officially supports Windows 7 and will, until it is not supported anymore. Qt6 won't waste resources supporting an unsupported OS. It holds the toolkit back and there are no customers paying for it, it seems. If you are stuck on an outdated OS, you can use an outdated toolkit. So Qt6 may still work, because there is no intention to break it, but there is no testing or support you can expect, unless you pay extra or work on it yourself. And if Windows 7 conflicts with a new feature, the new feature will probably win.

1

u/DeliciousIncident Dec 08 '20

Out of all Windows versions, they say that only Windows 10 is supported, i.e. other versions are not supported. Not sure why this is hard to understand and what you mean by "what level of not being supported is this?". They are just not supported, period. To give an example: while a Qt 6.0.0 program might run on Windows 7, it shouldn't come as a surprise if it stops working in some future version, e.g. Qt 6.0.1, and if you file a bug report about this - the bug report would be closed as WONTFIX as Windows 7 is not supported.

3

u/merlinsbeers Dec 09 '20

Could go the other way. They may add support for Windows 7. Just not on the rollout of Qt6.

1

u/the_gnarts Dec 08 '20

Windows 7 support?

Not even Microsoft support Windows 7.

3

u/zerexim Dec 09 '20

It does, through ESU, until 2023/2024. Besides, the world-wide market share of Win7 is still near 30%.

0

u/[deleted] Dec 08 '20

[deleted]

32

u/ClassicPart Dec 08 '20

Unsure why this comment is being downvoted.

https://www.microsoft.com/en-gb/microsoft-365/windows/end-of-windows-7-support

I did prefer 7 over 10 myself, but when it comes to your operating system, it's time to move on to 10 or another OS.

-9

u/JohnMcPineapple Dec 08 '20 edited Oct 08 '24

...

11

u/dagmx Dec 08 '20

It supports Windows. Just that Qt6 dropped support for Windows 7 since it's EOL.

0

u/voidtf Dec 09 '20

Native feel QML widgets, heck yeah !!

-10

u/[deleted] Dec 08 '20

qt legit made me cry once because it was an awful experience. I hope it is better now

0

u/[deleted] Dec 08 '20

[deleted]

1

u/the_gnarts Dec 08 '20

Qt legit still makes me cry occasionally as it was my introduction to GUI programming and sadly, it was all downhill from there.

0

u/[deleted] Dec 08 '20

[deleted]

4

u/NotUniqueOrSpecial Dec 08 '20

What are you actually doing?

Unless you're specifying the connection type (which implies you know exactly what you're doing), Qt will just do the right thing: signals/slots in different threads will use the event queue for thread safety, while those in the same thread won't.

I feel like you're leaving something out.

0

u/[deleted] Dec 08 '20

[deleted]

63

u/jtooker Dec 08 '20

In addition to what others have said, Qt 6 has made more effort to conform to (and work with) the standard library more.

14

u/whenthe_brain Dec 08 '20

They're also "extending" more of its types (namely, View classes) meaning it's kind of just becoming it's own thing. At this rate, all Qt needs to do is add a couple more classes and it can probably be considered an entirely new language.

42

u/whenthe_brain Dec 08 '20

They still "use" the standard library, but they have their own types for a lot of things, like QString, QVector, QList, QPromise, etc.

And I'm surprised a lot of QString/QVector's stuff isn't even in the standard library to begin with.

23

u/0x564A00 Dec 08 '20

Btw they merged QVector & QList (now there's only the later).

4

u/tansim Dec 08 '20

wait they removed QVector?? If i now want the qt-equivalent of a std::vector I need to type QList?

7

u/jontheburger Dec 09 '20

QVector will apparently be an alias of QList, which is indeed now the Qt equivalent of std::vector

https://www.qt.io/blog/qlist-changes-in-qt-6

3

u/GrecKo Dec 09 '20

QVector is now an alias for QList which became a container backed by a continuous storage. Read https://www.qt.io/blog/qlist-changes-in-qt-6 for more details

2

u/whenthe_brain Dec 08 '20

and I saw. I'm surprised it took them THAT long

29

u/guygizmo Dec 08 '20

And I'm surprised a lot of QString/QVector's stuff isn't even in the standard library to begin with.

Yeah, for mainly this reason the standard library sucks. Qt's types are, by and large, much better.

13

u/asegura Dec 08 '20

Totally agree. QString for example is so much better than std::string (and its friends).

7

u/zabolekar Dec 09 '20

std::string is rather the counterpart of QByteArray, not of QString.

2

u/asegura Dec 09 '20

Yes. So there is not a standard high-level, convenient text string class as in C# or Java.

5

u/otterom Dec 09 '20

Why? (Honest question.)

Is it more efficient? Forgiving? Adaptable?

5

u/asegura Dec 09 '20 edited Dec 09 '20

QString knows about text and is unicode aware, whereas std::string just holds a bunch of bytes. QString knows that text has case and can convert between lower and upper case, or compare ignoring it. It can format strings with variables, split a string by separators, use regexes, etc. It's UTF16 internally but can be initialized from raw char strings which it interprets as UTF8 (QString name = "Oδυσσευς";).

std::string knows nothing about case or character encodings. It's an alias for a byte (char) sequence and there are similiar aliases for "wide" characters and recently for UTF-x encodings (std::wstring, u8string, u16string, u32string).

Try to do this with std::string and just the standard library:

QString u = qstring.toUpper();

1

u/jcelerier Dec 09 '20

You can initialize a qstring without conversion with the u"string prefix"

0

u/[deleted] Dec 09 '20

[deleted]

1

u/otterom Dec 09 '20

Thanks!

I love regex, so I'll have to check it out.

0

u/[deleted] Dec 08 '20

[deleted]

2

u/granadesnhorseshoes Dec 08 '20

except its not really a 2 cm stone and the platform aint a 10 passenger jet. It's a 75lb Buddha statue and the platforms a single engine Cessna.

It'll still go just fine and your happy to have it along but it aint free and its usefulness is entirely in who you ask.

→ More replies (7)

3

u/Ameisen Dec 08 '20

There is a circuit simulation program that is very unstable that I've tried to fix, but the heavy (mis)use of Qt types and paradigms makes it very difficult. Blegh.

1

u/GrecKo Dec 09 '20

1

u/Ameisen Dec 09 '20

Nope. KTechLab.

It has a bunch of QT4-specific things and links them with KDE things as well. Makes it really hard to update, though I've stabilized many parts of it at least.

13

u/okovko Dec 08 '20

Qt implements reflection using macros plus a custom preprocessor. This enables the implementation of signals and slots, which are really nice.

The rest of it is plain C++. The Qt devs have different design goals than the standard C++ library, so they implement their own containers, etc.

Saying something isn't C++ because it doesn't rely on the standard library and has a thin preprocessing extension is a biiig stretch.

Qt makes use of core modern C++, for example you can connect a signal to a lambda.

1

u/merlinsbeers Dec 09 '20

Qt was traditionally way ahead on container objects, so they weren't restricted by the need to feel compatible.

4

u/okovko Dec 10 '20

I'm pretty new to Qt but so far I'm blown away by the design choices. Extending the C preprocessor with their own implementation to enable more expressive metaprogramming. Implementing reflection using macros, in the C style approach. Using pointer generics (where appropriate) instead of templates, to avoid ridiculous bloat and compilation time.

At every step, so far as I've seen, they chose the objectively superior solution over what was fashionable at the time. Beautiful.

32

u/be-sc Dec 08 '20

Qt never was a language extension.

The myth was probably caused by a few features that can make it appear like a language extension if you’re still unfamiliar with Qt; specifically the MOC and a few optional keyword-like macros such as emit.

However, the only thing you’ve ever needed to work with Qt is a normal C++ compiler. The MOC is a code generator that outputs standard C++ and might complicate your build system setup somewhat – especially when you’re not using QMake or CMake.

5

u/Ameisen Dec 08 '20

I'd question what a "language extension" is.

I have a runtime library (libxtd) which adds a lot of functionality to the language, but does it using C++ constructs. For instance, scoped locks using braces such as in Java or C#.

2

u/be-sc Dec 08 '20

Do you give existing language constructs new meaning at runtime only? Then … well … I’m not quite sure if I want to call it an extension or not. Nicely done, toeing the line like that. :-)

Or would a standard compliant C++ compiler fail to compile such code correctly? Then it’s definitely an extension.

2

u/Ameisen Dec 08 '20

Previous versions of libxtd required compiler extensions to fully function (MSVC's and GCC's), though I suspect (though I'm not entirely sure) that those can be removed due to additions in C++20.

My other library for AVR/uController work does rely pretty heavily upon compiler extensions to function, but then again, AVR work in general does.

6

u/HomeTahnHero Dec 08 '20

Technically true, but the Qt documentation literally says that the MOC “handles Qt’s C++ extensions”. That could be a bit confusing.

6

u/be-sc Dec 08 '20

Wow, I never knew that wording is in the official documentation.

Still, it’s a poor choice of words at least. As a rule of thumb I consider something a language extension when a standard compliant C++ compiler fails to compile it correctly. Otherwise you can call any kind of code generation “language extension”, which imo isn’t useful.

1

u/tansim Dec 08 '20

Did they finally drop the MOC? With modern C++ they shouldnt need it, yet I dont see it in the changelog anywhere...

9

u/DarkLordAzrael Dec 08 '20

C++ still lacks reflection, so I'm not sure why you think MOC could be dropped.

0

u/[deleted] Dec 08 '20

[deleted]

8

u/NotUniqueOrSpecial Dec 08 '20

I remember seeing something about reflection libraries using either C++17 or C++20 so reflection is in C++

By that logic MOC added reflection to C++ long ago, because all it does is generate C++ boilerplate that gives you, among other things, runtime reflection.

The libraries you're mentioning, like Refureku or RTTR either:

  • Use a generator, just like MOC

  • Require you to hand-write the boilerplate or write macro-heavy code.

So, no, C++17/20 don't solve the problems you think they do. Until reflexpr or something like it is in the standard, it's just how it is.

CopperSpice almost gets it there, but it has some caveats.

1

u/suitable_character Dec 09 '20

Why MOC is the problem? With CMake you don't even know it's used.

→ More replies (9)

13

u/HomeTahnHero Dec 08 '20

I think they still extend the language (via the meta-object compiler, or MOC).

7

u/Bolitho Dec 08 '20

IIRC there was a fork that wanted to remove the MOC functionality and substitute it by standard C++ stuff.

12

u/tracernz Dec 08 '20

2

u/merlinsbeers Dec 09 '20

Why would Qt not have done that themselves by now?

1

u/tracernz Dec 09 '20

Not all that long ago they were still trying to support C++98. They've dropped that legacy and gone minimum C++11 now I think, but this library requires C++14. One of the big reasons to support old C++ standards is vendor compilers for embedded systems.

2

u/merlinsbeers Dec 09 '20

That didn't answer why Qt haven't tried to get rid of moc. But reading the Verdigris blog it appears there's some very hairy template business under its hood. Qt may simply never have seen that solution well enough to code it, while they understand moc completely by now.

5

u/[deleted] Dec 08 '20

8

u/jtooker Dec 08 '20

You are correct. But Herb Sutter had a nice demonstration of what might possible with reflection a couple years ago.

0

u/[deleted] Dec 08 '20

[deleted]

2

u/MonokelPinguin Dec 08 '20

How would the second one work? The widget is drawn on the GUI thread, so you need to synchronize with that somehow. Could be signals/slots, coroutines, whatever, but you need to synchronize.

0

u/[deleted] Dec 08 '20

[deleted]

20

u/kowal059 Dec 08 '20

who tf prefers 8.1 over 10

11

u/barfoob Dec 08 '20

I'm a Vista man myself

5

u/greenjm7 Dec 08 '20

MS-DOS or bust!

5

u/afiefh Dec 08 '20

OS/2 gang assemble!

1

u/greenjm7 Dec 08 '20

Crap. Too many people! Buffer overrun!

1

u/Full-Spectral Dec 09 '20

1.0 of course, real men only need 16 bits.

3

u/Uristqwerty Dec 09 '20

10 has its forced-reinstall every year (except LTSC, but the complexity of getting access to that short of piracy makes it blatantly obvious it's not for the average user, so I'd expect there's orders of magnitude more 8.1 users than 10 LTSC), and that routinely comes with data corruption for a small random subset of users, plus miscellaneous annoying UI changes.

So, people who want maximum stability while still receiving security updates (8.1's still on Extended Support until January 10, 2023) and can tolerate a moderately-clunky Explorer UI might prefer it.

-3

u/[deleted] Dec 08 '20

Windows 8 has a worse UX for sure, but it's last version of Windows that isn't spyware. For people who want modern driver support and security patches without the constant nagging and advertisements from Microsoft, Windows 8 is okay.

2

u/kowal059 Dec 08 '20

i know that but and i tried using windows 8.1 i just couldnt use UX so i chose to debloat windows 10

-1

u/Superbead Dec 08 '20

I'd like to say I don't know why you're getting downvoted for this, but sadly I know why. Christ, there are waves of supposed IT professionals in the sysadmin sub heralding MS Edge with Chromium über alles, as if we weren't still fighting the 'legacy' of IE's former monopoly.

I too run 8.1 on my Windows machines and it's fine.

32

u/[deleted] Dec 08 '20

[removed] — view removed comment

7

u/GerwazyMiod Dec 08 '20

Great! Having one ecosystem for everything is dev dream. :)

6

u/divoPL Dec 08 '20

You might want to reevaluate your opinion about MS. .Net is now free, open-source and cross platform.

17

u/rob-ivan Dec 08 '20

Although you cannot create GUIs with it on anything else besides Windows, can you? At least not WPF apps afaik. Isn't that the main selling point of Qt? Correct me if I'm wrong as I am new to the C# ecosystem and don't know much about Qt.

6

u/domschm Dec 08 '20

There are several cross platform frameworks for .NET: AvaloniaUI, Uno Platform, Xamarin Forms, Eto Forms, ...

9

u/oblio- Dec 09 '20

None of those are as mature (or as free as in free beer) as Qt.

1

u/reluctant_deity Dec 09 '20

I can't speak to the maturity comparison, but Avalonia is free, no?

1

u/oblio- Dec 09 '20

Yeah, but it's not mature or supported by a large community AND a company.

Or has this changed recently?

3

u/reluctant_deity Dec 09 '20

Seems mature, but only the consulting/contracting side is commercial. The community is large enough that any issue I had was answered somewhere online.

1

u/-Rivox- Dec 09 '20

WPF is Windows Presentation Foundation, so yeah, Windows only. But WPF it's also the past. The future right now seems to be MAUI for native apps and Blazor for progressive web apps. At least as far as Microsoft is concerned.

The ecosystem is going in the right direction and I'd say it could become a real big competitor in the space. Imagine having only one language for all your apps, on all the platforms and also for the web. Businesses are going to love this