Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qpixmap not loadin files if there is space in the file name..
Forum Updated to NodeBB v4.3 + New Features

Qpixmap not loadin files if there is space in the file name..

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 2.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • R Offline
        R Offline
        RahibeMeryem
        wrote on last edited by
        #3

        Qt 5.11

        example file :

        /Users/xxx/Downloads/test_faces/fc/Ebr_Bai_cnnturk/8. ebr-bak-diz.jpg
        

        there is a space between 8. and ebr

        Mac OS X is the OS

        1 Reply Last reply
        0
        • R Offline
          R Offline
          RahibeMeryem
          wrote on last edited by RahibeMeryem
          #4

          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

          mrjjM 1 Reply Last reply
          0
          • R RahibeMeryem

            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

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            and
            QPixmap person_photoOLD(photo_path.toUtf8());
            dont work either ?

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              2
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                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 ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                2
                • dheerendraD Offline
                  dheerendraD Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on last edited by
                  #8

                  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.

                  Dheerendra
                  @Community Service
                  Certified Qt Specialist
                  http://www.pthinks.com

                  1 Reply Last reply
                  1
                  • R Offline
                    R Offline
                    RahibeMeryem
                    wrote on last edited by
                    #9

                    I solved through reading with opencv .

                    Certainly I missing something . Investigate further this week and post here.

                    Best

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved