Trivial Qt app which displays a sorted list of items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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