Unsolved no match for call to '(const QString) (const QString&)'
-
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(",")); }
-
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.
-
@SGaist How not to replace , but to extract?
-
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
-
@aha_1980 I do not understand. I have a link to the file. How to create QMediaObject?
-
@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:(
-
-
-
@JonB https://stackoverflow.com/questions/21562848/qt-getting-photo-metadata Then I ask what I want to do.
-
This post is deleted! -
@JonB Excuse me!
-
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.