From 006ae45dd0964398d51433cf95b9a1bc37b2f65b Mon Sep 17 00:00:00 2001 From: spillerrec Date: Tue, 18 Jul 2017 16:04:57 +0200 Subject: [PATCH] ADD: Prepend zeroes on extracted files number to always be 4 digits, to improve filename sorting --- src/FileUtils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FileUtils.cpp b/src/FileUtils.cpp index dce6dfe..fe53361 100644 --- a/src/FileUtils.cpp +++ b/src/FileUtils.cpp @@ -48,8 +48,10 @@ QList> extract_files( QString filename ){ QImage img; int i=0; - while( reader.read( &img ) ) - files.append( { QString::number( i++ ), img } ); + while( reader.read( &img ) ){ + auto index = QString( "%1" ).arg( i++, 4, 10, QChar{'0'} ); + files.append( { index, img } ); + } return files; }