How can we know the width and height of string ?
I want to create a button exactly the same size as the string for this i want the width and height of the string.
If you use layout than you can just properly specify size constraints. Otherwise you can use "QFontMetrics":http://developer.qt.nokia.com/doc/qt-4.7/qfontmetrics.html
In QML you can also use the paintedHeight and width properties. Take care of a detail (not sure it is a bug):
When you use a word-wrapped string you should forcerly add a '\n' character ad the end of the string else the painted properties alway returns the corresponding sized minus the last wrapped line.