Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Trivial Qt app which displays a sorted list of items
#include <QtCore/QStringListModel>
#include <QtWidgets/QApplication>
#include <QtWidgets/QListView>
#include <algorithm>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QListView view;
QStringList items{"James", "Alan", "Mark"};
std::sort(items.begin(), items.end());
QStringListModel model(items);
view.setModel(&model);
view.show();
return app.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment