QByteArray to QString

You can use QTextCodec to convert the bytearray to a string: (1015 is UTF-16, 1014 UTF-16LE, 1013 UTF-16BE, 106 UTF-8) From your example we can see that the string “test” is encoded as “t\0 e\0 s\0 t\0 \0 \0” in your encoding, i.e. every ascii character is followed by a \0-byte, or resp. every ascii character is encoded as 2 bytes. The … Read more

How to change string into QString?

If by string you mean std::string you can do it with this method: QString QString::fromStdString(const std::string & str) If by string you mean Ascii encoded const char * then you can use this method: QString QString::fromAscii(const char * str, int size = -1) If you have const char * encoded with system encoding that can be read with QTextCodec::codecForLocale() then you should use … Read more

Error: C2228: left of ” must have class/struct/union

You made an error here: You declared a function called myDBControl taking no arguments and returning a DatabaseControl. Object declarations without any constructor arguments must omit the (): This is related to (but is not precisely) the “most vexing parse“, in that it’s caused by the same language rule that statements are function declarations if … Read more

How to install PyQt5 on Windows?

The easiest way to install PyQt is to just use the installer (Link in your answer, step #5). If you install python 3.3, the installer will add all of the PyQt5 extras to that python installation automatically. You won’t need to do any compiling (none of: nmake, nmake install, python configure). All of the build … Read more

error: expected unqualified-id before ‘if’

You can’t have free-standing code like that. All code needs to go into functions. Wrap all that in a main function and you should be ok once you’ve fixed your use of QTextStream (it has no eof method, and it doesn’t have a readline method either – please look at the API docs that come with usage examples).

“Symbol(s) not found for architecture x86_64” on QtCreator project

I’m getting the error Trying to compile a project on QtCreator. It happens when I try to create an instance of an user defined class, Layer. That class consists of a header, layer.h, and a implementation, layer.cpp. It was tested and works in another programs. On my project, it is included in qtwidget.h and the error happens when I try … Read more