Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: Qt classes vs. standard C++

A large amount of functionality is duplicated between standard c++ and Qt. At some point it seems logical but many times it looks foolish. Like I feel like doing a new programming language, learning things which I already know. e.g. using QFile.

Also if I do it all Qt way and suppose now I want to move out of Qt framework it will be too much tedious to rewrite that code. OTOH I like Qt because it provides me with libraries which otherwise I would have to fish myself like webkit, database connectivity, dbus etc.

What do you suggest mix standard C++ or do it pure Qt way?

like image 525
Xolve Avatar asked Aug 19 '10 15:08

Xolve


People also ask

Is Qt standard C++?

Qt is not a programming language on its own. It is a framework written in C++. A preprocessor, the MOC (Meta-Object Compiler), is used to extend the C++ language with features like signals and slots.

What is Qt class?

Class ListsA list of all modules in Qt 6. All Namespaces. A Qt namespace contains enum types, functions, and sometimes classes. All QML Modules. A list of all QML modules in Qt.

What is the difference between Qt and C++?

C++ source code on compilation provides non-portable object code. So, C++ supports the WOCA (Write Once, Compile Anywhere) principle. Qt is a C++ toolkit for graphical user interface (GUI) and application development. It is appropriate for embedded systems both with and without a UI.

What is qt5 C++?

Qt is a full development framework with tools designed to streamline the creation of applications and user interfaces for desktop, embedded, and mobile platforms.


1 Answers

As there is no GUI in C++ you should abstract the GUI code from the rest of the real code.

Then within your QT implementation of your GUI abstraction feel free to use QT code.
You will also then be able to write Wx/Quartz GUI abstraction without affecting the real code.

In the real code (were the work is done) stick to standard stuff (or cross platform libs that are nearly standard (boost)). One could argue that QT is cross platform. Just remember that that using a lib here will be tightly coupling your code the lib, thus extracting it latter date will be non trivial. (see the previous question about removing Rouge Wave from a legacy application)

like image 77
Martin York Avatar answered Sep 29 '22 21:09

Martin York