Important: Please read the Qt Code of Conduct -

[Solved]QListWidgetItem text should be of two lines only.

  • Hi,

    I am working with QListWidget in icon mode and adding QListWidgetItem dynalically to the list.
    I have a problem that I was to restrict the text at the bottom of QListWidgetItem to two lines. So that it should look like the one below:

    Text line 1
    text line 234......

    In second line I want to display description which could be quite long but it should end up with '...' instead going to next line.
    Any help is appreciated.


  • Lifetime Qt Champion


    A QStyledItemDelegate sounds the way to go

  • Thanks for the reply.
    I resolved the issue by using QFontMetrics elidedText ().


Log in to reply