I'm adding a QListWidgetItems to a QListWidget. Is there any way to set the size of the QListWidgetItem according to it's content data?
QSize size(50, 20);
QListWidgetItem* newItem1 = new QListWidgetItem();
newItem1->setText("short text");
newItem1->setSizeHint(size);
listWidget->addItem(newItem1); //listWidget is previously created
QListWidgetItem* newItem2 = new QListWidgetItem();
newItem2->setText("this is a very long text");
newItem2->setSizeHint(size);
listWidget->addItem(newItem2);
Text of newItem1 is displayed without any problem. But the newItem2 text is not fully displayed. It only shows few characters and then "..." as text elide. How to show the complete text without the elide? I want to set the size according to the size of item's data without setting any constant numbers.