1
votes

I have a custumWidget which displays 3 QLineEdits. These customWidgets are stored inside a QListWidget like this:

QListWidgetItem* item = new QListWidgetItem();
ui->listWidget->insertItem(index, item);
ui->listWidget->setItemWidget(item, customWidget);

I set a minimum size within the customWidget:

ui->lineEndit->setMinimumSize(50, 200);

But when I resize the window, I can resize it even smaller than the stipulated minimumSize. Does my minimumSize get lost / ignored (for example in my customWidget)?

(Using Qt 5.1, C++11)

1
sad, that nobody seems to know the answer. - Estefunny

1 Answers

2
votes

You should set the size policy for the line edit according to your needs. Take a look at http://doc.qt.io/qt-5/qsizepolicy.html#Policy-enum to find the right size policy.

ui->lineEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
ui->lineEdit->setMinimumSize(50,200);