Qpixmap not loadin files if there is space in the file name..
-
Hi,
I have iterator :
QDirIterator it(folder, QStringList() << "*.jpg" << ".jpeg" << "*.png", QDir::NoFilter, QDirIterator::Subdirectories);if
QString photo_path = it.filePath();has space
QPixmap person_photo(photo_path);is not loading image..
how can I load images has space in their file names?
-
Hi,
That shouldn't be a problem. Please show the exact file path that doesn't work.
Also:
What version of Qt are you using ?
On what platform ?
How do you know it's not loaded ? -
Qt 5.11
example file :
/Users/xxx/Downloads/test_faces/fc/Ebr_Bai_cnnturk/8. ebr-bak-diz.jpgthere is a space between 8. and ebr
Mac OS X is the OS
-
Hi @SGaist
QPixmap person_photoOLD(photo_path); QImage p_ersonqimg(photo_path); QPixmap person_photo = ASM::cvMatToQPixmap(cv::imread((photo_path.toUtf8().constData())));photo_path is a problematic path including space.
first to is unsuccesfull.
but if I read with opencv than transform to Qpix all path is succesfully read.
I didnt understand honestly
-
Hi @SGaist
QPixmap person_photoOLD(photo_path); QImage p_ersonqimg(photo_path); QPixmap person_photo = ASM::cvMatToQPixmap(cv::imread((photo_path.toUtf8().constData())));photo_path is a problematic path including space.
first to is unsuccesfull.
but if I read with opencv than transform to Qpix all path is succesfully read.
I didnt understand honestly
Hi
and
QPixmap person_photoOLD(photo_path.toUtf8());
dont work either ? -
I can't reproduce it here on linux so I guess something else is wrong. First I would use it.absoluteFilePath() and then QFile::exists() to see if it the path is really readable. Then rename the file so it only has one dot to check if it is readable then.
-
I can't reproduce it either with 5.11.2 nor 5.12 self built on macOS High Sierra.
Might be a silly question but are you sure it's only a space ? Or do you have special chars in that path ?
-
Is there some format issue with images ? Are you able to open the problem images from any other tool ? As everybody already said, definitely it is not a file path issue or space issue. I strongly suspect the format issue with image.
-
I solved through reading with opencv .
Certainly I missing something . Investigate further this week and post here.
Best