Qt World Summit: Submit your Presentation

Repaint QListWidget's icons when resizing

  • Hello.

    I have a problem with a QListWidget in icon mode : at startup, the icons are painted so as they take the maximal width of the widget. But when the QListWidget is resized, the icons keep the same location whereas there is more available horizontal space to dispose them. Is this a normal behaviour of QListWidget? Is there any way to draw the icons again when the widget is resized?


  • Lifetime Qt Champion

    The behavior is correct - or does e.g. your file explorer automatically resizes the icons when there is more spaces available.
    I think you're looking for QListView::gridSize(). Make sure the icons you use are available in the desired size.

Log in to reply