1

I need to copy the full filepath, without filename, into a QString from QFileDialog below.

  QString fileName = QFileDialog::getOpenFileName(this,
      tr("Select app to install"), '/' , tr("APK Files (*.apk)"));
László Papp
  • 51,870
  • 39
  • 111
  • 135
Jocala
  • 243
  • 1
  • 4
  • 16
  • possible duplicate of [qt filedialog directory](http://stackoverflow.com/questions/3097259/qt-filedialog-directory) – nobody Jun 24 '14 at 15:13
  • @AndrewMedico: that one is now closed as the duplicate of this. That one might be even deleted based on the downvote numbers. – László Papp Jun 25 '14 at 01:48

1 Answers1

1

You use QString QFileInfo::absolutePath() const for this. See the documentation for details.

QFileInfo fileInfo(QFileDialog::getOpenFileName(this,
  tr("Select app to install"), '/' , tr("APK Files (*.apk)")));
qDebug() << fileInfo.absolutePath();
László Papp
  • 51,870
  • 39
  • 111
  • 135