Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved no match for call to '(const QString) (const QString&)'

    General and Desktop
    4
    12
    2266
    Loading More Posts
    • 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.
    • H
      haifisch last edited by

      How do I extract the latitude and longitude from a picture file? Now, when I process several files, I get an error: no match for call to '(const QString) (const QString&)'.

      filesLatitude.append(QMediaMetaData::GPSLatitude(Files.at(i)));
      filesLongitude.append(QMediaMetaData::GPSLongitude(Files.at(i)));
      

      Full function UploadPhotosVideo:

      void MainWindow::UploadPhotosVideo(QString PhotosVideo) {
          if(PhotosVideo == "Photos") {
              Files = QFileDialog::getOpenFileNames(
                          this,
                          tr("Открыть файлы"),
                          "C://",
                          "Все файлы (*.*);;Файлы изображений (*.png *.jpg *.jpeg *.bmp)"
                          );
          } else if(PhotosVideo == "Video") {
              Files = QFileDialog::getOpenFileNames(
                          this,
                          tr("Открыть файлы"),
                          "C://",
                          "Все файлы (*.*);;Файлы видео (*.dv *.avi *.mpeg *.mov *.dvd *.flv *.mp4)"
                          );
          }
          Progress->show();
          Progress->setMinimum(0);
          Progress->setMaximum(Files.size()-1);
          Tab->setEnabled(false);
      
          QStringList filesName;
          QStringList filesLatitude;
          QStringList filesLongitude;
          QString newDir = QString(QDir::currentPath()+"/%1_%2").arg(QString(QDate::currentDate().toString()).replace(" ","_")).arg(QString(QTime::currentTime().toString()).replace(":","_"));
          QDir().mkdir(newDir);
          for (int i=0; i<Files.size();i++) {
              if(PhotosVideo == "Photos") {
                  qDebug()<<"+++"<<Files.at(i);
                  filesLatitude.append(QMediaMetaData::GPSLatitude(Files.at(i)));
                  filesLongitude.append(QMediaMetaData::GPSLongitude(Files.at(i)));
              }
              filesName.append(QFileInfo(Files.at(i)).fileName());
              QFile::copy(Files.at(i),newDir+"/"+QFileInfo(Files.at(i)).fileName());
              Progress->setValue(i);
              msg_view->append("Файл:"+Files.at(i)+" СКОПИРОВАН В:"+newDir+"/"+QFileInfo(Files.at(i)).fileName());
          }
          Tab->setEnabled(true);
          Progress->hide();
          QDynamicButton *buttonUploadPhotos = (QDynamicButton*) sender();
          QList<QLineEdit*> _ListLineEditPhotos = buttonUploadPhotos->getListLineEdit();
          for (int i=0;i<_ListLineEditPhotos.count();i++)
              _ListLineEditPhotos[i]->setText(filesName.join(","));
      
      }
      
      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        @haifisch said in no match for call to '(const QString) (const QString&)':

        QMediaMetaData::GPSLatitude

        This a constant. So basically, you are trying to replace its value which you can't.

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

        H 1 Reply Last reply Reply Quote 1
        • H
          haifisch @SGaist last edited by

          @SGaist How not to replace , but to extract?

          aha_1980 1 Reply Last reply Reply Quote 0
          • aha_1980
            aha_1980 Lifetime Qt Champion @haifisch last edited by

            @haifisch

            https://stackoverflow.com/questions/42396954/qt-get-jpeg-exif-metadata-for-datetime seems to describe exactly your problem.

            As described there, you need to use the QMediaObject::metaData() method to extract one of the QMediaData variables.

            Regards

            Qt has to stay free or it will die.

            H 1 Reply Last reply Reply Quote 1
            • H
              haifisch @aha_1980 last edited by

              @aha_1980 I do not understand. I have a link to the file. How to create QMediaObject?

              JonB 1 Reply Last reply Reply Quote 0
              • JonB
                JonB @haifisch last edited by JonB

                @aha_1980

                @haifisch said in no match for call to '(const QString) (const QString&)':

                @aha_1980 I do not understand. I have a link to the file. How to create QMediaObject?

                The trouble is, in that link the conclusion in the comments (https://stackoverflow.com/a/42411030/489865) was:

                Thanks. So i have to create a mediaObject? I already have the path as a string. – Jans Raberta Feb 23 '17 at 10:39
                I don't know how to get a suitable QMediaObject from a filename or contents - I tried to find it hidden in there, but the Qt Multimedia seems more oriented towards building capture devices than for graphics editors. :( – Toby Speight Feb 23 '17 at 10:46

                :(

                H 2 Replies Last reply Reply Quote 1
                • H
                  haifisch @JonB last edited by

                  @JonB Here : mediaObject->metaData(QMediaMetaData::DateTimeOriginal).toDateTime(); How to get a mediaObject? I have a link to the file only. Which is stored in the list. "Files.at(i);"

                  JonB 1 Reply Last reply Reply Quote 0
                  • JonB
                    JonB @haifisch last edited by

                    @haifisch
                    I know what you are asking. I am asking the same to @aha_1980 , wait for his response.

                    H 2 Replies Last reply Reply Quote 0
                    • H
                      haifisch @JonB last edited by

                      @JonB https://stackoverflow.com/questions/21562848/qt-getting-photo-metadata Then I ask what I want to do.

                      1 Reply Last reply Reply Quote 0
                      • H
                        haifisch @JonB last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • H
                          haifisch @JonB last edited by

                          @JonB Excuse me!

                          1 Reply Last reply Reply Quote 0
                          • aha_1980
                            aha_1980 Lifetime Qt Champion last edited by

                            I've read up http://doc.qt.io/qt-5/qmediaobject.html and the only thing I can tell for now is, that photos seems to be not supported.

                            QMediaObject is inherited by QAudioDecoder, QCamera, QMediaPlayer, and QRadioTuner. So there seems no way to use QMediaMetaData for existing JPEG photos, at least for my knowledge.

                            As described in the SO link, https://github.com/mayanklahiri/easyexif may be some lightweight alternative.

                            Qt has to stay free or it will die.

                            1 Reply Last reply Reply Quote 4
                            • First post
                              Last post