Qt UI for an existing C ++ project

I already wrote a program in C ++, and I would like to write a graphical interface for it. I understand that Qt is a great tool, but Qt has its own classes that confuse me. for example: instead of String, Qt has a class called QString ..

I am wondering if I can mix C ++ code and Qt code in C ++?

+5
source share
6 answers

Yes, you can easily mix Qt and STL.

The graphical interface takes QString, but silently creates these forms std::stringor char*, QStringsreturned from the Qt, they can be converted using toStdString()or toAscii().

Qt , .

Qt ++, "" , , .

edit: thanks bill

+7

std ++ Qt .

, ++ , Qt-, . MVC/MVP , .

, / .

+1

, , ! , QString toAscii(), Qt . , Qt ( , ), ++ Qt- ( ++)

0

! Qt - , ++. Qt , Socket, Containers, Network,... STL , Qt. , Qt , -, . , , , Qt , , Windows, Linux Mac OS, .

0

.

++ , STL . , ex-Trolltech , STL, Qt. Qt QTL, QtAlgorithms QString.

, STL:

  • STL (, , push_back(), empty() ..)
  • Qt / STL (: QVector:: toStdVector, QList:: fromStdList)
  • Qt STL
  • QString / std::string std:: wstring toStd (W) String/fromStd (W) String

Personally, I like QString more than std :: string, it is easier to use and more powerful.

0
source

Yes, you can.

I really made a Qt-GUI wrapper for a set of C-based functions. There are no problems with Qt integration, only a low level of C (which is a memory leak ...).

See here: http://code.google.com/p/qhocr/

0
source

All Articles