Is it possible to adjust QListWidget height and width to it\'s content?
sizeHint()
always returns 256, 192
no matter what its content is.
First you should get your largest string in the list, that is easy to obtain.
After you get that string, do the following:
QFontMetrics * fm = new QFontMetrics(widget->font());
QRect rect;
rect = fm->boundingRect(string);
rect.width() has the width in pixels of the largest string rect.height() has it's height.
Set the QListWidget width to that rect's width (plus the margins) and it's height to that rect's height times the number of items
I didn't test the code, but hope it puts you on the right track