
Originally Posted by
Zlatomir
and i would add remove the heap allocations
Have you? You don't see it in your code but:
{
}
void QListWidget::insertItem(int row, const QString &label)
{
Q_D(QListWidget);
d->listModel()->insert(row, new QListWidgetItem(label));
}
To copy to clipboard, switch view to plain text mode
And as you might guess, addItem is just a convenient function for insertItem, so you could at least save one function call by using insertItem direct. But the real problems, to point them out, are in the takeAt() like, the "incorrect" use of mid(), the loop itselfs...
Bookmarks