How different is Qt4 from Qt3? - c++

I used to program in Qt3 a long time ago and I had read a great book that I still have by O'reilly on Qt3. I wanted to start using Qt4 again now several years later.
Can I use my Qt3 book to get up to speed again, or has things changed so much that I should buy a Qt4 book?

In a nutshell:
Qt 4 is (even) better -- and more powerful and flexible -- than Qt 3
you'll be fine!
The Porting to Qt 4 documentation gives some idea of the many small changes to APIs.
What's New in Qt 4 gives an overview of the big differences between Qt 3 and Qt 4.
Some major changes that noone has mentioned so far:
Model/View architecture
template container classes
a new, modular build system
a new action-based main window implementation
widget styling with CSS
ports for S60 and other platforms
There are also lots of small fixes, improvements and useful new classes such as QFormLayout and QSignalSpy.

You should consult the Qt books page at Nokia.
Two books from that page are available freely:
C++ GUI Programming with Qt 4 (first edition) by Jasmin Blanchette and Mark Summerfield
An Introduction to Design Patterns in C++ with Qt 4 by Alan Ezust, Paul Ezust

Qt3 support classes still exist in Qt4 but Qt has developed itself very much. I think using your Qt3 book will slow you down. It is best if you buy a new book.
If you don't want to spend money on a book, examples, tutorials & documentations are very helpful.

You can find a 3 to 4 guidelines document with all the differences on Nokia's site.
I would recommend a Qt 4 book to a Qt 3 one, but since you have already worked with Qt, I think that you can just use the docs and be ok.

Most of the things remain quite similar. There was some cleanup, but the basics (signal-slot mechanism for example) remain the same. You still have all those QStrings, QActions, QDialogs etc. Your Qt3 knowledge should remain valuable.
On the other hand there are many new elements. There's a big QGraphicsView framework, Phonon framework for multimedia files, QtWebKit HTML engine, QtConcurrent engine for multithreading etc. You might want to learn all the new goodies.
Trolltech (what's the current name?) always has good documentation, so check What's new in Qt4 and you should be fine with API reference for the latest Qt4 version.

If you know Qt, this
http://qt.nokia.com/doc/4.5/classes.html
should be okay to get adapted.
For redirection to documentation for the latest version of Qt use one of the following links: http://doc.trolltech.com/latest/ or http://qt.nokia.com/doc/latest/

I say you use the designer for a while and look at the generated code. I used it to learn how to work with Qt4.

Qt4 is much more powerful than Qt3 ever was (especially now, as Qt 4.6 draws near, even though Qt 4.0 had some shortcomings). Your knowledge of Qt3 will let you do basic stuff with Qt4 as the style hasn't changed much for basic functionality, but to truly use all the power of Qt4, you will need to learn things that are Qt4 specific.

Related

Qt Quick controls 2.0 for embedded device

My long term goal is to make HCI development for embedded devices, and by embedded I really mean it, not phone devices.
I've been working on Qt Widgets for a month now, avoiding Qt Quick for some reasons (I feared that QML code wasn't optimize), but yesterday I have watched this video :Youtube
The speaker says at the end : "If you're making an embedded product these days, use Qt Quick, especially now in 5.8. There's no excuse not to use Qt Quick"
But on the contrary, he explains that for embedded devices we should use c++ code, not JavaScript.
I don't really get it, does it means that I have to create all my objects in c++ code and make my architecture using Qt Quick ?
I don't really get what Qt want us to do. Is it just communication, since they don't want to optimize the old and stable Qt widgets, or is Qt Quick really the solution for embedded devices ?
I personally think that Qt is not the solution for embedded devices, as they keep evolving, changing strategy, and seems not to know where they are going.
I apologize for this non-algorithmic question, and thank you for all your answers.
I can't speak to the developer's intent, nor can I speak for other developers. I can only speak to what I understand, as a developer that has been designing embedded devices for 40 years (sorry for being a number dropper).
C++ or JavaScript? I don't feel that question has too much to do with whether you use QtQuick or not. Sure, you can embed some JaveScript in QML code (with limitations), but you can also use C++ in the same code base (just not embedded in the QML). Then there's Python. Both Qt and QtQuick are programming frameworks, and are somewhat language agnostic.
My perspective is that QtQuick is a good, portable way to create your user-interface code. In my current project (a multi-axis industrial servo-control system) I use QML for the user-interface (with a little JavaScript where needed), C++ for the bulk of the higher level processing (like network control and data-streaming), C and assembly language for the lower levels (those routines executed in uC's and DSP's). QML and C++ interface together nicely, in my opinion.
I believe the speaker is getting at the idea that most if not all your business logic should be done using a C++ model back-end. It is possible to do all your logic just in QML with embedded JavaScript however, because JS is an interpreted language its performance at run-time can possibly be less than compiled C++ code(dependent on how well the C++ is written).
Essentially you only want to use JS to manipulate graphical components while using C++ with QObject models to update the QtQuick elements' individual properties.
This is mentioned in the Qt Quick Best Practices wiki,
https://wiki.qt.io/Qt_Quick_Best_Practices

Anyone know of a book or documentation like MFC Internals for Qt?

I have recently read MFC Internals (ISBN 9780201407211) and it helped me greatly gain an intimate understanding of how MFC works and increased productivity about 100 fold. I was wondering now that I am into Qt, is there any book or documentation out there like this? I have been having a hard time finding straight-up documentation on Qt, it always seems to be beat-around=the-bush style of documentation (they tell you how to build the house, but not how to cut down the tree) ??
The best way is to try developing your own application. Just start from a basic application like calculator. Add a few widgets to it and code it as you go. For reference use "C++ gui programming with Qt4" mentioned by Zlatomir. I have recently designed a whole GUI using Qt. I drew its screenshots on Inkscape to get a prototype look and afterwards I started working on designer to fulfill each functionality. Then I implemented the code and I repeated the designing and coding steps. Also, the best help will be Qt Assistant - its sufficiently complete, no Internet required so save times and simple to use. Going my way, you will not only learn Qt in short interval after which you can go through the book to know what tips and tricks you might not know, but also it will be interesting so that you may not give up like many others who just fall midway through the reading part. Warning - Doing this way, you will also know about pitfalls/drawbacks of Qt and how to not go that way.
This is one of the links I found last night. I went through 2 pages and found it might make your life a bit easier - http://zetcode.com/gui/qt4/
I have not read the MFC book you mentioned, but the Qt framework i learned by reading from "C++ gui programming with Qt4" (the first edition is available as a free download) and "Foundation of Qt development" and also it's worth mentioning this documentation page, that contains links to the basic concepts of Qt framework.

How to develop nice-looking, visually modern applications in QT?

I'm wondering how to develop visually modern, with attractive GUI applications in QT. When I run QT Creator and start new project, the GUI looks very basic and "pure", just like simple win32 apps. But look for example at Allegorithmic Substance Designer 2, where GUI looks somehow similar to WPF. There are many other applications with nice-looking GUI. So, the question is: how to do this? Is there any extension/library to QT, which provide richer GUI experience? Or it must be developed from scratch? Thanks for replies in advance.
As well as Nano's answer, I think it would be worth your while to search around for any Qt stylesheets others have made.
For example, this one that mimics Microsoft Office.
Unfortunately, there doesn't seem to be very many of them available.
I found these useful links, some of whose links may give some ideas:
Qt Stylesheet Snippet Repository
Another idea might be to search for example qml files in Google Code Search. This search for .qml files has plenty of hits. Before using any of them, you would obviously need to check its license.
Have you tried Nokia's Qt Creator? If you're looking for something "similar" to WPF I assume you're referring to its declarative nature, QML being XAML's counterpart in such regard.

gtkmm and MSAA accessibility

I'm interested to know if gtkmm w/ ATK (or whatever) works with MSAA like Qt does. We're looking right now at switching toolkit from WX and it turns out that our testing software relies on MSAA to do it's thing (something I wish I'd known 3 years ago when we picked WX to begin with). Of all the GUI toolkits, I prefer GTKmm mainly due to it's use of signals and slots but in a way much more expressive and generic than Qt's....and without the need for the extra build step that requires the Qt VS plugin. The designer is much better too.
So I'd like to use GTKmm but the only discussions and google stuff I can find on the topic are 3+ years old. They lead me to believe the answer is no, it doesn't support it and if it does it's really shoddy. But a lot can change in 3 years.
So, anyone that uses GTK or GTKmm on win32 know if it supports the windows accessibility framework?
I can’t say for sure but I would lean toward very little to no support. I use the Jaws screen reader SOFTWARE SINCE I’m blind. It uses MSAA quite heavily and GTK applications such as Pidgin are almost completely inaccessible. While I can read some of the text on a screen figuring out weather I’m in an edit field or weather a button is selected is impossible. If my screen reader can’t deal with GTK applications I assume your testing software will have major issues as well.
I don't know if this is still being tracked but I will second this assessment as another windows screen reader user. gnuCash was the app I tried and it was pretty rough going. Worked like a dream in Gnome with Orca though. Apparently, it's like this, if you want windows accessibility, use QT and WxWidgets. If you want Linux, use gtk+. QT is going to be accessible in Linux apparently though this is yet to be (not till gnome 3, I think). Pity you had to abandon WxWidgets. I personally like their widgets since it has those sizers which take much of the guess work out of placement of controls. Important when you can't see and you want to build a gui. Looks like about the only cross-platform accessibility solutions right now are Xul and SWT (Java, you know). Sad thing about WxWidgets is that this sort of thing was reported to them two years ago but nothing seems to have been done about it.
http://trac.wxwidgets.org/ticket/9785
I would be delighted to know that I am wrong about this. I doubt it, though.

Real life use for Qt (outside of Nokia)

Is Qt an interesting platform for business apps development, outside of Nokia phones ?
Why ? Strong points ?
Thanks
I like Qt because:
Very well-designed framework, e.g. signal-slot, model-view, graphics view/scene/item/proxy, painter/paint device/paint engine..., too many to be listed here!
Excellent documentation!
Cross platform language/API, as well as tools like UI designer, creator, and so on.
Rich features, e.g. graphics framework, network library, database engine, and so on.
Active community, and active development.
There should be more. If you have ever used it, you'll find it's easy to build your framework upon Qt.
I didn't have any complain to Qt. If I have to say at least one disadvantage here, "convention". You must adopt the convention of Qt, e.g. You have to use moc to make the meta object of your objects, and it's easier for developers to use Qt's vector, list, auto_ptr than STL, tr1. But I never found any issue caused by that. On the contrary, it works very well.
In my opinion, Qt is the state-of-the-art C++ framework in this modern world!
P.S. There are a lot of commercial applications built on Qt. You can find it under Qt's official website. But I'd like add one more here: Perforce, one of the top commercial source code management tools, built its client tool on Qt for Windows/Linux/Mac.
yes it is .. just look at kde apps :)
or see more applications made by qt
and it has alot of bindings in many languages
Documentation
cross-Platform IDE
further reading
may be this is not so related to the question ... but my first deal with qt was just great starting from their well organized Documentation to their great widgets
the GraphicsView is just ammazing ! :)
It's about the only current/modern C++ gui library on Windows.
MFC is so old you have to write comments in Latin
WTL would be nice if they had finished it before abandoning it.
Winforms/WPF + managed C++/CLR - all the fun of several incompatible new technologies at once.
Bad points:
To fit on lots of platforms they have invented their own solutions to things that are now in the STL/Boost
The signal/slot mechanism - tricky to debug and silently fails (with no error) with simple typos.
Although everything is possible it's sometimes a lot of effort to do simple things (they do love MVC) compared to Winforms.
Qt is simple
Qt is powerful
Qt is NATIVELY-CROSS-PLATFORM
Qt is REALLY-CROSS-PLATFORM
Qt is comprehensive (but the Media side of it still needs to grow)
Qt doesn't require Garbage Collection, but it embeds a GREAT model of memory management that makes you forget about memory deallocation
Qt is solid
Qt is modern
Qt proposes some new paradigm of programming that are really good (Signals-Slots)
Qt runs a lot of VERY successful software: (Skype, Google Earth...)
Are those points strong enough?
Maybe you have heard about Google Earth which happens to be programmed in Qt too.
That aside, I like Qt for my in-house development because it
is very well supported and documented,
allows me to write simple and decent-looking apps that are
works cross-platform for Windows and Linux with little effort, and
contains nice to have components for database access, regexps, guis, xml, ...
I also use the Qwt widgets for easy real-time plotting on top of Qt.
I really dont understand whats the point in underestimating tools/frameworks which makes things easy for programmers. Qt is too good for GUI development, I would say its much better than any current existing crossplatform app development suite.
So many advantages, I have been using it for more than three years now for a product to be deployed in Linux/Win environments. The app is thread intensive and initially we had a tough time using pthreads and its conterpart for windows. Then we switched to Qt(and QThreads eventually) and things were a breeze...
Backed by active development, a highly helpful and supportive community along with excellent documentation, training, certification programs, videos, forums... its easy, fast and effective to develop in Qt. You should see the video which they create a web browser in just five mins!
Its really 'cross platform', and it doesnt have a software wrapper(like Java does) to enable this which makes it faster. Cmon, we all know java apps have buttons which takes a second to respond to even a simple 'click'.
I hope Qt will someday do a take on Java. :D
after all, 350000 developers cant be wrong when they chose Qt.
Pixar uses Qt (or at least, used, as of 2005) internally for certain parts of their tool suite (called "Marionette" in the marketing) collectively called Menv, ("men-vee" for Modelling ENVironment)---at least for their lighting sub-tool Lumos.