Hacker News new | past | comments | ask | show | jobs | submit login
Qt 5.3 Release Candidate Available (digia.com)
48 points by bratao on May 8, 2014 | hide | past | favorite | 22 comments



Qt has shaped up to be such an attractive, pleasant-to-use framework. QML has turned out quite convenient, too. It's a pity that Qt's foundation remains a fundamentally memory-unsafe language like C++.

I'm using a lot of languages now that offer significantly more safety, both memory and type (including OCaml, Golang, and playing with Rust).

Even with the very welcome additions of C++11/14, it still seems like I'm stepping back into a previous era when I write C++. I use C occasionally, but when I do I know I'm manipulating memory directly, and if I'm not careful it can bite me. C++ has adopted so many modern language features that it's easy to forget it shares many of the same attributes as C, even if most of them are now avoidable with care and attention.

One nice response to this dilemma is Niemeyer's go-qml (sponsored by Ubuntu, if I'm not mistaken). go-qml allows you to create your main Qt program in Go, leaving QML for the layout only. So no C++ at all (except under the covers, of course). I look forward to seeing how go-qml evolves [1].

1. https://github.com/go-qml/qml


> It's a pity that Qt's foundation remains a fundamentally memory-unsafe language like C++.

<Groan> Come on.

C++ takes 1 to 2 years tops to develop good habits provided you either read the effective C++ series or you have a good mentor. Just like any other language. What it sounds like you're saying is that programming languages should not require expertise. Maybe. It can be instructive to look at other engineering disciplines to see how much they rely on fundamental knowledge or how much their tools abstract for them to see how programming will go.

That being said, I do (rarely) run into memory issues when it comes to threading but the last time I had a buffer overrun or anything of that sort was probably years ago. I reckon these threading bugs are easy to create with most languages, except maybe Go.

When C++ adopts a proper module specification, my last complaint about it will be gone (compile times).


>C++ takes 1 to 2 years tops to develop good habits provided you either read the effective C++ series or you have a good mentor. Just like any other language.

But it's really not like any other language. In most other modern languages, you can write relatively safe code while you're mastering it. You may write unidiomatic code as you're learning, but you're not going to leave integer overflows or (with some modern languages) null pointer errors throughout your code.

So yes, I guess am saying programming languages should not require years of expertise. It's beneficial to have a Python or Go expert around, but you can write perfectly respectable code in these languages after a few weeks if you're an experienced programmer. Even in other paradigms like OCaml and Haskell, I see most skilled programmers picking up idiomatic usage after a few months.

What's idiomatic C++? What's safe C++? It's hard to define, and it's a vast language. C and C++ are fine tools to use if you're already an expert (except for those pesky bugs that bring down Internet security).

But for new language learners, there are thankfully a new wave of safe, type safe languages coming on board.


C++03, sure, but not C++11.

If any C++11 course begins with using raw pointers or arrays, they're doing the students a disservice. There are safe and unsafe parts of the language, the trick is when to use which.

Go, Erlang, etc are all designed to be used for particular purposes. Go may break out of its box because it is a general purpose language, but its core use case is concurrency just like Erlang. I honestly doubt it will because its syntax is ugly, though not as fugly as C++ can be.

I feel like the majority of C++ programmers would support gun ownership, which might say a lot.


One or two years is a lot... Learning python took me a month, maybe. Learning C a few months. Learning Objective-C 3-4 months. Hell, I learned quite a bit of Erlang in two weeks during christmas.

(Although I'm also a big believer in the "10,000-Hour Rule".)

C++ is too complex/powerful.


Bingo. I've learned pretty fluent Go in the course of a month. I've been programming in C++ for years and still feel shaky sometimes.


> What it sounds like you're saying is that programming languages should not require expertise.

No, I think he says that C++ is overly complex and unsafe without a real need for that complexity and unsafety. And it seems that what you define as "expertise" translates to "the developer learned to make up for the language flaws". Expertise should mean having the necessary knowledge to make software quickly and efficiently, not avoiding the language pitfalls. When you have to read so much text in order to use a language correctly, then there probably is some problem in it.

Take a look at Rust, it's aiming for the same niche as C++ while being less complex and giving safety guarantees. And they seem to be having success at that. It's doable.

I recommend you the post that I link below. It tries to explain to a C++ programmer why he should learn Rust. It has modules, generics, green threads and concurrency built in. There's much to love. http://featherweightmusings.blogspot.com.ar/2014/04/rust-for...


I wasn't born knowing C++. I read a couple of books (Effective C++ and TC++PL), kept up with it and I've done fine. Is the real shift that people don't want to read books on programming anymore? Maybe they just want bite-sized tutorials.


You're discussing this issue with people who are learning Go and Rust. At least speaking for myself, I would have been thrilled to have access to Go and Rust programming books -- would have made things much easier.

So that's not the issue.


Qt has a very friendly high-level C++ style though, which makes it hard to create memory errors (unless one insists on working with raw pointers and C-style arrays), and the code is pleasant to look at and read (IMHO of course). It's also a great multi-platform framework beyond pure UI stuff.


I agree completely. Qt makes C++ a relative pleasure to use. I'm only speaking to the memory safety of the language.


PyQt for - you guessed it - python is a superb wrapper for Qt.


And PySide if you want to avoid GPL! We are lucky to have two high-quality Python bindings into Qt.

http://qt-project.org/wiki/PySide


You can also "avoid GPL" by paying Phil Thompson for the awesome work he does: http://www.riverbankcomputing.co.uk/commercial/buy

(To clarify: PyQt commercial licenses are not GPL)


I can certainly respect commercial software projects, and have no problem shelling out a few hundred for quality software that I'll use frequently. But $600 for a commercial license to the bindings of a open source graphics library is pretty excessive in my mind.

Clearly, Riverbank is shooting for the enterprise users, and good for them if they're finding enterprise clients to pay that amount, but for independent software developers making small commercial products that might net a few thousand USD, that's too much.

So it shouldn't be surprising that people are happy to have alternatives.


The only shame with Qt and C++ is the difficulty of providing bindings for other languages. It's just such an immense set of libraries to wrap by hand. You also have to duplicate the work of moc.


This is an unfortunate reality for people building Qt bindings. I've always hoped that a coalition of Haskell, Nimrod, D, Rust, Lua, C#, Objective C, and other languages with easy C interop could come together and build a well-engineered C interface to Qt that was easy to maintain.

There was QtC, but it fell apart a few years ago. There's also Smoke, but looking at an examples of its use[1], I can't help but think a well-designed C interface would be much easier to work with (disclaimer: I've never used Smoke).

1. http://techbase.kde.org/Development/Languages/Smoke


Its a shame the the new features page in Qt 5 doesn't have screenshots. Pictures are always easier to digest and the new features page always seem to be a great marketing opportunity v.s. just a list of things.

Compare the 5.3 page http://qt-project.org/wiki/New-Features-in-Qt-5.3

With the 4.5 page: http://doc.qt.digia.com/4.5/qt4-5-intro.html


feature request: add a richtext control that doesnt suck (like richtext)


I have been building Qt 5.3 and Qt Creator almost weekly and the move from X11 to XCB sounds attractive but when it comes to font rendering, it is terrible. All the fonts looked washed out and it just leaves me with sore eyes.


The move to XCB has no impact on font rendering.

QWidget continues to use the same font rendering stack it has for many years, i.e. fontconfig to interact with system fonts, harfbuzz for layout and Xft/FreeType for rasterization.

Qt Quick 2 supports two different ways of rasterization. The default one is a GL-based rasterizer using the distance field method. The other is FreeType. You can switch between them on a per-item basis: http://doc-snapshot.qt-project.org/qt5-stable/qml-qtquick-te...

Most likely your problem is that you're seeing the distance field render. The advantage of the distance field renderer is that it produces more even results in animated transformations (e.g. scaling text up or down over a number of frames), but the disadvantage is rendering fidelity (particular preserving the full detail of glyph shapes) and that it's just not consistent with other things using FreeType alongside it.

In KDE Plasma Next, which extensively uses Qt Quick 2 for nearly all UI, we're mostly using FreeType rasterization for that reason.


I was talking about the rendering that Qt-Creator uses inherently. If you know of a way to control that, it would be great. The only option I see is under Editor->Fonts as "Enable/Disable antialiasing" which isn't really helpful since I use Ubuntu Mono, Monaco etc.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: