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. no match for call to '(const QString) (const QString&)'
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 3.2k Views 1 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.
  • H Offline
    H Offline
    haifisch
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      1
      • SGaistS SGaist

        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.

        H Offline
        H Offline
        haifisch
        wrote on last edited by
        #3

        @SGaist How not to replace , but to extract?

        aha_1980A 1 Reply Last reply
        0
        • H haifisch

          @SGaist How not to replace , but to extract?

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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
          1
          • aha_1980A aha_1980

            @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

            H Offline
            H Offline
            haifisch
            wrote on last edited by
            #5

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

            JonBJ 1 Reply Last reply
            0
            • H haifisch

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

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @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
              1
              • JonBJ 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 Offline
                H Offline
                haifisch
                wrote on last edited by
                #7

                @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);"

                JonBJ 1 Reply Last reply
                0
                • H haifisch

                  @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);"

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #8

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

                  H 2 Replies Last reply
                  0
                  • JonBJ 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 Offline
                    H Offline
                    haifisch
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • JonBJ JonB

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

                      H Offline
                      H Offline
                      haifisch
                      wrote on last edited by
                      #10
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • JonBJ JonB

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

                        H Offline
                        H Offline
                        haifisch
                        wrote on last edited by
                        #11

                        @JonB Excuse me!

                        1 Reply Last reply
                        0
                        • aha_1980A Offline
                          aha_1980A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          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
                          4

                          • Login

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