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
-1
votes
1 answer

Showing sub string after specific character

I want to show sub string after "<". for example I have this statements: input: " o
Farzan Najipour
  • 2,442
  • 7
  • 42
  • 81
-1
votes
2 answers

Why there is error in assigning values to QString

I want to access the Qstring (m_IPAdd) from a Dialog Window to Main Window. However, I am stuck in passing a Qstring value in a setter function. My error appears as a pop-up window when debug mode: unhandled exception occurs at 0x66a77448…
Ryan
  • 279
  • 1
  • 4
  • 12
-1
votes
1 answer

How to parse QString?

I am trying to parse QString with following code: QString name = "name.bin"; QStringList imgName = name.split("."); qDebug() << imgName.at(0); // result is "name" However I need just name without any ("). Then I write another code to manually…
goGud
  • 4,163
  • 11
  • 39
  • 63
-1
votes
2 answers

Get elapsed time as a formatted string

I am looking for the simplest way to calculate and display the execution time of a function in Qt. The result should be a string/QString in the format mm:ss. I know I can get an int of milliseconds with QTime but is there a built-in function which…
isADon
  • 3,433
  • 11
  • 35
  • 49
-1
votes
3 answers

Finding the second maximum number from file in Qt

I am a beginner in Qt, in the below code, I found out the maximum number, but I need to find the second maximum number, too. int max; max = List.at(0).toInt(); for(int i=1; imax) max =…
-1
votes
1 answer

Allocating words from a string separated by spaces to a variable? C++ [qt]

I just wanted to know what the technical term for allocating words from a string separated by spaces to a variable is called so I can look up a tutorial for it. Any terms, links, or explanations would be greatly appreciated.
user3183403
  • 63
  • 1
  • 2
  • 8
-1
votes
1 answer

How can I convert HEX encoded Unicode to a QString?

I have a file that contains Strings like: 444541191800B45D01FF00004593244700013030303535202 I think that these are unicode strings. How can i convert them to a Qt QString object? I tried the following: QByteArray ar1 =…
RED SOFT ADAIR
  • 12,032
  • 10
  • 54
  • 92
-1
votes
2 answers

Can't find the right regexp

I'm working with QString (Qt 4.8) and I want to extract this kind of string src="http://media.cineblog.it/9/91f/Big-Bad-Wolves-primo-trailer-per-il-crime-thriller-israeliano.jpg" from QString using QRegExp. But I can't find the righ regular…
-1
votes
2 answers

Why can't I use QString::arg function here?

You know that everywhere you need a QString object as a parameter you can use just c style strings . For example showMessage function needs QString. But I passed a C-style string to this function and every thing is OK. I mean here we can think of …
s4eed
  • 7,173
  • 9
  • 67
  • 104
-1
votes
1 answer

ofstream writing data to file: How do I pass a previously defined string as the filename

I have a program that I have written with C++, OpenCV and Qt, where I am trying to write data to a csv file. In my Qt Widget I have created a QFileDialog that allows me to choose where to save the csv file. This path is then stored as a QString, and…
JM92
  • 1,063
  • 3
  • 13
  • 22
-2
votes
1 answer

Split object propery values and create new array of object if they split

I have object like this. I getting this object on backend with query and then transform with qs string library. { color: 'red,white', size: 'xl', manufacturer: 'adidas,nike' } I would like have array of object, what i need for prisma map…
Radas
  • 33
  • 1
  • 6
-2
votes
3 answers

Regex for QString::split() for two float numbers

I have the QString line like this "567\n1.23456 2.34567\n1.23456 2.34" And I want only "whole" float numbers only between \n characters. I need QStringList after split() that contains only this float numbers. QString::split() can use RegEx so maybe…
AmeZir
  • 1
  • 2
-2
votes
1 answer

How to convert QString containing an exponential number to double in C++?

I want to convert QString("3.285072743893E-04") to double without compromising the precision. When I use QString::toDouble the result is 0.000328507. I have read somewhere that it is just a matter of how the value is displayed. Does that mean, that…
Archiac Coder
  • 156
  • 2
  • 13
-2
votes
3 answers

Using QString get strange characters in the output

int a=0; while (a<2) { //infos.stops is point to one array, called abc[10] output = output + QString::fromStdString(*infos.stops)+ "." ; infos.stops++; a++; } ui->showMsg->setText(output); The problem is infos.stops did show, but…
bluedream
  • 999
  • 2
  • 12
  • 15
-2
votes
3 answers

type required : Passing String as parameter to function

Good day all note: I am a begginer at c++, teaching myself as I go along, also apologies if this is a duplicate, but I have not found an example/answer/tutorial to answer question, possibly I just do not understand it yet. I have a function with…
CybeX
  • 2,060
  • 3
  • 48
  • 115
1 2 3
52
53