sizeHintForColumn not returning size including icon size
-
Hi,
I am trying to add item that have icon and label to QlistWidget, and I want to resize my item to its content that where I am using sizeHintForColumn to adjust, but its just returning size of text hence my text is getting cropped.Code:
void QTListWidget::addItems() { for(int i = 0 ; i < 10 ; i++) { QLabel* pLabel = new QLabel(QString::fromStdString("labelText") + QString::fromStdString(getString())); QListWidgetItem* item = new QListWidgetItem(); item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); //addIcon item->setIcon(QIcon("success-16x16.png")); //size item to widget current max widget item->setSizeHint(QSize(this->sizeHintForColumn(0) + 1, 20)); addItem(item); setItemWidget(item, pLabel); } }Result:

Is there any way we can get size and adjust it to fit the contents?
Any help is very much appreciated.