Questions tagged [qstring]

A QString is a class in Qt library which implements character strings.

QString holds a unicode string inside, and provides a set of useful functions to manipulate the data, including easy concatenation, trimming, search and replace, and conversion functions.

QString can also be converted to std::string and vice-versa with toStdString() and fromStdString() respectfully:

QString str = QString::fromStdString( std::string("Hello, World!") );

std::string str = QString("Hello world!").toStdString();

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

791 questions
0
votes
2 answers

How can I find out if a specific character in a QString is a letter or punctuation?

How can I find out if a specific character in a QString is a letter or punctuation in any language? For example I want to find the . in gâteau. but not the â.
castors33
  • 477
  • 10
  • 26
0
votes
1 answer

File handling with pyQT

I'm developing a piano learning software. For that I need save details of profiles registered by the user. Now I'm using python file handling but there are some issues. So what should I do to use XML or Qstring files.Suppose I've to save…
Hemanth Raveendran
  • 157
  • 2
  • 3
  • 8
-1
votes
1 answer

Convert QByteArray to QString

I want to encrypt the data of a database and to do this, I used AES_128 in this link for encryption. The result of encryption is a QByteArray and the QByteArray is saved on the text file in the correct shape and I could decode it correctly, but and…
Javad_R
  • 1
  • 3
-1
votes
1 answer

QString convert camel case to space separated words

I am trying to convert a camel cased QString into lowercased words separated by spaces. I currently have: QString camelCase = "thisIsACamelCaseWord" QString unCamelCase = camelCase.replace(QRegularExpression("([A-Z])", " $1")).toLower(); Which…
Daniel Lord
  • 754
  • 5
  • 18
-1
votes
3 answers

double quotes problems in Qstring

QProcess p; QString aa = "tasklist /FI 'IMAGENAME x32dbg.exe' /FO LIST | findstr 'PID:'"; aa.replace(0x27,0x22); qInfo() << aa; p.start(aa.toStdString().c_str()); p.waitForFinished(); qInfo() << "Output:" << p.readAllStandardOutput() << "Error:" <<…
-1
votes
1 answer

send data beteen form qt5

I want to send data from from to another one I'm new in qt i googled my problem and find many solution but no one focused one qstring value login.cpp void Login::GetSerial() { QString s1 = cmd("WMIC cpu get ProcessorId"); s1 =…
Fadi Heart
  • 11
  • 4
-1
votes
1 answer

QString replace element

I try to replace QString img=":/images/f0000.png"; If pVaule is 51 img should be ":/images/f0001.png" If pVaule is 71 img should be ":/images/f0021.png" But my result is pVaule is 51 img ":/images/f000\u0001.png" pVaule is 71 img …
5407
  • 39
  • 9
-1
votes
1 answer

No matching function for call to 'QString::fromLatin1(QByteArray*&)'

I have a class A that calls class B after a signal is emitted. When the user closes B, I am trying to transfer a QString value from B to A. To do so, I first convert the QString to a QByteArray, then I am exchanging the QByteArray between classes.…
WKstraw
  • 67
  • 1
  • 13
-1
votes
2 answers

How do I extract a set of numbers from a QString that are after an space or before/after a bracket?

I'm new in QT and not that new in C++. and although I'm not that good of a programmer I try. This time I can't figure a way to. I'll be doing a QT application and I'll be having data in the form of [1 2 45 345 98 452] (It could be either that or…
-1
votes
2 answers

Qt C++ QRegExp remove the text before dot

I'm looking to split and remove a QString. There are several words in the QString, separated by one or more(×) of the following symbols: A-frame×N A-line×NA A-OK×A A-pole×N A-Z test×h A/C×N output N NA A N h N src Qt C++ QStringList…
usef62
  • 11
  • 1
-1
votes
1 answer

What is the difference between the following Qt QStrings which take Json string as input? Using QTcpSockets

I have a json message to send over a QTcpSocket. Before sending message, the Json message is formatted as below: Case 1 : //Heartbeat = QString("{\"messageType\":\"Heartbeat\", \"Thread_Name\":%1, \"Heartbeat\":%2}").arg(Thread_Name).arg(HbCount); …
ringul
  • 47
  • 7
-1
votes
1 answer

How can I pass arguments off a QFile to other function on QT?

I have this code, and i want to pass the directory off the file selected on the "void MainWindow::on_pushButton_2_clicked() " function to the " char* videoName ". How can I do it? I dont know how to do it, please help me!!!!1 #include…
-1
votes
1 answer

How do i split a Qstring to new line

Spliting a string to a new line in Qt c++ Qstring is Qstring str = "diskinfo: Node: ASHUTOSH-PC, Description: Local Fixed Disk, FreeSpace: 418581491712, Name: C:, Size : 499875049472 Node: ASHUTOSH-PC, Description: CD-ROM Disc, FreeSpace: , Name:…
cyley
  • 63
  • 1
  • 12
-1
votes
2 answers

Access Code in QString with Unicode Terminator

I want to make sth. like the following Code... Has someone an idea? Thank you :) QString x = QString("\ue001"); if(x.startsWith("\ue")) { //... }
-1
votes
2 answers

QString - parsing QString with geoordinates

I work in Qt Creator (Community) 5.5.1. For example, I have string="44° 36' 14.2\" N, 33° 30' 58.6\" E, 0m" of QString. I know, that I must parse it, but i don't know how, because I have never faced with the problem like it. From our string I want…
Khan
  • 81
  • 1
  • 5