Copy path to QString

前端 未结 1 745
南笙
南笙 2020-12-22 04:14

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

  QString fileName = QFileDialog::getOpenFileName(this,
      tr(\         


        
相关标签:
1条回答
  • 2020-12-22 04:50

    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();
    
    0 讨论(0)
提交回复
热议问题