Skip to content

Instantly share code, notes, and snippets.

@robertknight
Created October 13, 2013 13:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save robertknight/6962650 to your computer and use it in GitHub Desktop.
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