Solved QtXML: setAttribute(const QString & name, int value): can we set two value ??
-
Hello,
setAttribute(const QString & name, int value).. I want to give two value for my attribute
for example
<xyz pos="100,200">
Many Thanks -
setAttribute(QString &, int)
is an overloaded method of
setAttribute(QString &, QString &)
so
setAttribute("pos","100,200");
should do what you expect.
-
@the_ yes
setAttribute("pos","100,200");
but i want to use variable like this
setAttribute("pos","X,Y");
and x =100, y=200
but in this case it will print x,y now setAttribute("pos","x,y");
-
just create a string out of x and y separated by ","
-
@the_ but how?
-
You can find it here :)
QString ClassQString str; int intval = 10, intval2=20; str = QString::number(intval) + "," + QString::number(intval2); //or str = str = "%1%2%3"; str.arg(QString::number(intval),",",QString::number(intval2));
-
@the_ Many Thanks dear