The arg () method of the qstring is used to populate the string with the%1,%2 ... for a given parameter, such as
QString m = tr ("%1:%2:%3"). Arg ("n"). Arg ("a"). Arg ("a"); m = "12:60:60:
It also has another overloaded method:
QString qstring::?arg (int a, int fieldwidth = 0, int base = ten, Qchar Fillchar = Qlatin1char (")) const
This method is used to populate the%1,%2 in the string ... for a fixed number, where the first parameter is the number to fill, the second parameter is the minimum width, the second argument is a binary, and the fourth parameter is the character used for padding when the original number is less than the minimum width.
Such as
QString Text = QString ("%1:%2") . Arg (123, 5, Ten, Qchar (' 0 ')) . Arg (456, 5, Ten, Qchar (' 0 ')); Text = "00123:00456"
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Use of the ARG () method for Qt qstring