Search code examples
c++user-interfaceqtqstring

Qt UI for existing C++ project


I have already written a C++ program and I would like to write a GUI for it. I realize Qt is a wonderful tool, however, Qt has it's own classes, which make me quite confused. eg: instead of String, Qt has a class named QString..

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


Solution

  • Yes you can intermix Qt and STL very easily.

    The GUI takes QStrings but will silently create these form std::string or char*, QStrings returned from Qt can be converted with toStdString() or toAscii().

    Qt includes a set of collection classes but you don't have to use them.

    Qt does a good job of looking like modern C++, there are a few 'extras' to handle the signal and slot event mechanism but these are more a complication to the build environment than to the code.

    edit:thanks bill