Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can we know the width and height of string ?
pratik041 last edited by
I want to create a button exactly the same size as the string for this i want the width and height of the string.
p-himik last edited by
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
Alicemirror last edited by
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.