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);

            if(mChatList!=NULL)
            {
                QListWidgetItem *newItem = new QListWidgetItem(mChatList);
                newItem->setSizeHint(QSize(myChat->width(), myChat->height()));
                mChatList->setItemWidget(newItem, myChat);
                row = mChatList->row(newItem);
                myChat->storeRowNumber(row);
                mChatList->scrollToItem(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?

    Thanks



  • Hi,

    I found the solution. Here is the link

    "Your text to link here...":https://qt-project.org/forums/viewthread/30732/

    thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.