fix issue #48, sort img_names naturally

This commit is contained in:
Yonghye Kwon 2021-05-23 13:02:55 +09:00
parent 53890e1b17
commit e67234bc5c

View File

@ -6,7 +6,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QDebug> #include <QDebug>
#include <QShortcut> #include <QShortcut>
#include <QCollator>
#include <iomanip> #include <iomanip>
using std::cout; using std::cout;
@ -314,11 +314,15 @@ void MainWindow::open_img_dir(bool& ret)
QFileDialog::ShowDirsOnly); QFileDialog::ShowDirsOnly);
QDir dir(imgDir); QDir dir(imgDir);
QCollator collator;
collator.setNumericMode(true);
QStringList fileList = dir.entryList( QStringList fileList = dir.entryList(
QStringList() << "*.jpg" << "*.JPG" << "*.png", QStringList() << "*.jpg" << "*.JPG" << "*.png" << "*.bmp",
QDir::Files); QDir::Files);
std::sort(fileList.begin(), fileList.end(), collator);
if(fileList.empty()) if(fileList.empty())
{ {
ret = false; ret = false;