You know, it's kind of impossible to say what's the problem without seeing any code. Anyway, here's two ways of listing files in an alphabetic order.
1) using QComboBox::InsertAlphabetically:
#include <QtGui>
int main(int argc, char* argv[])
{
combo.
setInsertPolicy(QComboBox::InsertAlphabetically);
combo.
addItems(QDir("/home/jp").
entryList(QDir::Files |
QDir::NoDotAndDotDot));
combo.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QComboBox combo;
combo.setInsertPolicy(QComboBox::InsertAlphabetically);
combo.addItems(QDir("/home/jp").entryList(QDir::Files | QDir::NoDotAndDotDot));
combo.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
2) using QDir::Name sort flag
#include <QtGui>
int main(int argc, char* argv[])
{
combo.
addItems(QDir("/home/jp").
entryList(QDir::Files |
QDir::NoDotAndDotDot,
QDir::Name));
combo.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QComboBox combo;
combo.addItems(QDir("/home/jp").entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name));
combo.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks