How do I change int to QString?

Asked 1 years ago, Updated 1 years ago, 117 views

Is there a function that takes int as a factor and returns QString? I'm looking for a function like intToQSTring() in the code below!

int i = 42;
QString s = intToQSTring(i)

qt c++ type-conversion

2022-09-22 22:29

1 Answers

Write QString::number() Returns the string that converts the number n to its true value.

The function prototype is as follows: QString QString::number(long n, int base = 10)

The true value is set to 10 by default, and the range is [2,36]. If it is not a decimal, n is considered unsigned int.

int i = 42;
QString s = QString::number(i);


2022-09-22 22:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.