Important: Please read the Qt Code of Conduct -

Prepend items in QListWidget - Qt [SOLVED]

  • Hi,

    I am drawing a custom list of items in the following manner:

    @mChatList = new QListWidget(this);@

    @ CustomChatBubble *myChat = new CustomChatBubble(message);

                QListWidgetItem *newItem = new QListWidgetItem(mChatList);
                newItem->setSizeHint(QSize(myChat->width(), myChat->height()));
                mChatList->setItemWidget(newItem, myChat);
                row = mChatList->row(newItem);


    This is working fine and the list scrolls to the latest item as well.

    Now i want to show older messages in the same list which should load before the existing items in the list. I tried to use @insertItem(item, row) @ method for this but that is also just appending items to the list. I want a kind of prepend operation.

    Can somebody suggest something on this?


  • Hi,

    I found the solution. Here is the link

    "Your text to link here...":


Log in to reply