D
D
devalone2017-04-01 18:57:56
Qt
devalone, 2017-04-01 18:57:56

How to set height for QListWidget?

There is a form on it QLineEdit and QListWidget placed in QVBoxLayout, sizePolicy fixed for QListWidget and method QSize sizeHint() const overridden;

QSize CommandListWidget::sizeHint() const
{
    return QSize(1, 1);
}

But for some reason, the size is not set to less than some value and it is clearly greater than 1 by 1.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Sokolov, 2017-04-01
@jimquery

Try setting a minimum size for the widget:
list.setMinimumSize(QSize(1, 1));

I
Ighor July, 2017-04-02
@IGHOR

If there are more items in the list than the visible area, it is better not to use QListWidget, QTableWidget but only QListView and QTableView

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question