当前位置: 首页>>代码示例>>C++>>正文


C++ QFileDialog::setDirectory方法代码示例

本文整理汇总了C++中QFileDialog::setDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileDialog::setDirectory方法的具体用法?C++ QFileDialog::setDirectory怎么用?C++ QFileDialog::setDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QFileDialog的用法示例。


在下文中一共展示了QFileDialog::setDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OpenWAVFile

void MainWindow::OpenWAVFile()
{
QFileDialog *g  = new QFileDialog(this);
#if  QT_VERSION==0x040806 || defined(Q_OS_UNIX)
g->setNameFilter("Audio Files (*.wav | *.mp3)");
#else
g->setNameFilter("Audio Files (*.wav;*.mp3)");
#endif
#if QT_VERSION>=0x050000 && !defined(Q_OS_UNIX)
g->setDirectory(lastdirR);
#endif
if(g->exec())
{
ui->listWidget->clear();
f = fopen(g->selectedFiles().at(0).toLocal8Bit().constData(),"rb");
fread(&format,1,44,f);
fclose(f);
ui->locut->setMaximum(format.SampleRate/2);
ui->hicut->setMaximum(format.SampleRate/2);
ui->locutslider->setMaximum(format.SampleRate/2);
ui->hicutslider->setMaximum(format.SampleRate/2);

filename = g->selectedFiles().at(0);
QFileInfo info(g->selectedFiles().at(0));
lastdirR = info.absolutePath();
ui->actionApply_Effect->setEnabled(true);
ui->pushButton->setEnabled(true);
}
}
开发者ID:ajffj4,项目名称:TCenterChannelExtractor,代码行数:29,代码来源:mainwindow.cpp

示例2: saveAsLabelledResult

bool ImageViewer::saveAsLabelledResult(QString &pathResult)
{
    if(!_srcOcvImage) return false;
    if(!_displayImage) return false;
    if(!_result_display) return false;

    QFileDialog *fDlg = new QFileDialog(this);
    fDlg->setWindowTitle(tr("保存标注结果"));
    fDlg->setAcceptMode(QFileDialog::AcceptSave);
    fDlg->setFileMode(QFileDialog::AnyFile);
    fDlg->setViewMode(QFileDialog::Detail);
    fDlg->setDirectory(QDir::currentPath());

    fDlg->setFilter(MOLI_IMAGE_FILTER);
    fDlg->setDefaultSuffix("png");

    if(fDlg->exec() == QDialog::Accepted)
    {
        QString filename = fDlg->selectedFiles()[0];
        if(_result_display->save(filename))
        {
            pathResult = filename;
            return true;
        }
        else return false;
    }
    else return true;
}
开发者ID:Wushaowei001,项目名称:labelling3,代码行数:28,代码来源:ImageViewer.cpp

示例3: on_saveDebugInfoButton_clicked

/**
 * @brief Stores the debug information to a markdown file
 */
void SettingsDialog::on_saveDebugInfoButton_clicked() {
    QFileDialog dialog;
    dialog.setFileMode(QFileDialog::AnyFile);
    dialog.setAcceptMode(QFileDialog::AcceptSave);
    dialog.setDirectory(QDir::homePath());
    dialog.setNameFilter(tr("Markdown files (*.md)"));
    dialog.setWindowTitle(tr("Save debug information"));
    dialog.selectFile("QOwnNotes Debug Information.md");
    int ret = dialog.exec();

    if (ret == QDialog::Accepted) {
        QStringList fileNames = dialog.selectedFiles();
        if (fileNames.size() == 0) {
            return;
        }

        QFile file(fileNames.at(0));

        if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
            qWarning() << file.errorString();
            return;
        }

        QTextStream out(&file);
        out.setCodec("UTF-8");
        out << ui->debugInfoTextEdit->toPlainText();
        file.flush();
        file.close();
    }
}
开发者ID:LiangWei88,项目名称:QOwnNotes,代码行数:33,代码来源:settingsdialog.cpp

示例4: selectAssetDir

void ZoneViewerWindow::selectAssetDir()
{
    QFileDialog fd;
    fd.setFileMode(QFileDialog::Directory);
    fd.setDirectory(m_scene->assetPath());
    fd.setWindowTitle("Select an asset directory");
    // OpenGL rendering interferes wtih QFileDialog
    m_viewport->setAnimation(false);
    if((fd.exec() == QDialog::Accepted) && (fd.selectedFiles().count() > 0))
        m_scene->setAssetPath(fd.selectedFiles().value(0));
    m_viewport->setAnimation(true);
}
开发者ID:pixelbound,项目名称:equilibre,代码行数:12,代码来源:ZoneViewerWindow.cpp

示例5: on_readBtn_clicked

void codecs::on_readBtn_clicked()
{
    QFileDialog *dialog = new QFileDialog();
    dialog->setDirectory(curDir);
    dialog->setWindowTitle("Open *any* file to decode if possible");

    readFileToBuffer(dialog->getOpenFileName());
}
开发者ID:CaledoniaProject,项目名称:QCodeCS,代码行数:8,代码来源:codecs.cpp

示例6: onBrowse

/**
Handler for the onbrowse event.
*/
void SlicingAlgorithmDialog::onBrowse() {
  QFileDialog dialog;
  dialog.setDirectory(QDir::homePath());
  dialog.setNameFilter("Nexus files (*.nxs)");
  if (dialog.exec()) {
    ui.txt_filename->setText(dialog.selectedFiles().front());
  }
}
开发者ID:liyulun,项目名称:mantid,代码行数:11,代码来源:SlicingAlgorithmDialog.cpp

示例7: browseMount

void Settings::browseMount() {
	QFileDialog *fd = new QFileDialog(this);
	fd->setFileMode(QFileDialog::DirectoryOnly);
	fd->setAcceptMode(QFileDialog::AcceptOpen);
	fd->setDirectory( txtMount->text() );
	if (fd->exec())
		txtMount->setText( fd->selectedFiles()[0] );
}
开发者ID:OS2World,项目名称:APP-DATABASE-CdFly,代码行数:8,代码来源:settings.cpp

示例8: choosePath

void MainWindow::choosePath() {
    QFileDialog dirDialog;
    dirDialog.setFileMode(QFileDialog::DirectoryOnly);
    dirDialog.setDirectory(ui->lineEdit_3->text());
    if(dirDialog.exec()) {
        if(!dirDialog.selectedFiles().isEmpty())
            ui->lineEdit_3->setText(dirDialog.selectedFiles().at(0));
    }
}
开发者ID:rbrtslmn,项目名称:FDP,代码行数:9,代码来源:mainwindow.cpp

示例9: OpenDir

void BrowsePicture::OpenDir()
{
  QFileDialog *fileDialog = new QFileDialog(this); 
  fileDialog->setWindowTitle(tr("选择图片所在文件夹路径")); 
  fileDialog->setDirectory("../"); 
  fileDialog-> setFileMode( QFileDialog::DirectoryOnly ); 
  if(fileDialog->exec() == QDialog::Accepted) { 
    pic_path = fileDialog->selectedFiles()[0]; 
  }
}
开发者ID:qhw,项目名称:deal_bmp,代码行数:10,代码来源:browsepicture.cpp

示例10: on_btnSelectOutputFolder_clicked

void MainWindow::on_btnSelectOutputFolder_clicked() {
    QFileDialog fileDlg;
    fileDlg.setOption(QFileDialog::ShowDirsOnly, true);
    fileDlg.setFileMode(QFileDialog::DirectoryOnly);
    fileDlg.setDirectory(ui->txtOutpuFolder->text());
    if (fileDlg.exec()) {
        ui->txtOutpuFolder->setText(fileDlg.selectedFiles().at(0));
        AppSettings::setOutputFolder(ui->txtOutpuFolder->text());
    }
}
开发者ID:xandroalmeida,项目名称:YAVC,代码行数:10,代码来源:mainwindow.cpp

示例11: slotBrowseFlow

void PreferencesDialog::slotBrowseFlow()
{
    QFileDialog dialog;
    dialog.setAcceptMode(QFileDialog::AcceptOpen);
    dialog.setFileMode(QFileDialog::ExistingFile);
    dialog.setDirectory(QFileInfo(ui->buildFlow->text()).absolutePath());
    if (dialog.exec() == QDialog::Accepted) {
        ui->buildFlow->setText(dialog.selectedFiles().at(0));
        slotValidateFlowBinary();
    }
}
开发者ID:msylvest,项目名称:slowmoVideo,代码行数:11,代码来源:preferencesDialog.cpp

示例12: showDirDialog

void CategoryDialog::showDirDialog()
{
    QFileDialog *dlg = new QFileDialog(this);
    dlg->setDirectory(ui->catpath->text());
    dlg->setAttribute(Qt::WA_DeleteOnClose);
    dlg->setFileMode(QFileDialog::DirectoryOnly);
    dlg->setWindowTitle(tr("Выбор директории"));
    dlg->setOption(QFileDialog::DontUseNativeDialog);
    dlg->setModal(true);
    connect(dlg,SIGNAL(fileSelected(QString)),this,SLOT(setCategoryDir(QString)));
    dlg->show();
}
开发者ID:bywyu,项目名称:rexloader,代码行数:12,代码来源:categorydialog.cpp

示例13: on_btnSelectOutputDirectory_clicked

void MainWindow::on_btnSelectOutputDirectory_clicked()
{
    QFileDialog fileDlg;
    fileDlg.setOption(QFileDialog::ShowDirsOnly, true);
    fileDlg.setFileMode(QFileDialog::DirectoryOnly);
    fileDlg.setDirectory(ui->txtOutputDirectory->text());
    if (fileDlg.exec())
    {
        ui->txtOutputDirectory->setText(fileDlg.selectedFiles().at(0));
        QSettings().setValue("outputDirectory", ui->txtOutputDirectory->text());
    }
}
开发者ID:xandroalmeida,项目名称:DiskRescue,代码行数:12,代码来源:mainwindow.cpp

示例14: open

/**
 * @brief MainWindow::open
 * Open new Mesh File
 */
void MainWindow::open(){
QFileDialog     *fd;
QString         filter;

  fd = new QFileDialog();
  fd->setDirectory(sampleDir);
  FileName = fd->getOpenFileName(this,tr("Open Mesh Files"),sampleDir,"Mesh Files ( *.ply)", &filter);
  if (!FileName.isEmpty()){
    ui->glwidget->setMeshFile(FileName.toStdString());
    ui->glwidget->initialize();
  }
}
开发者ID:njrizzo,项目名称:tucano,代码行数:16,代码来源:mainwindow.cpp

示例15: OpenFile

void MainWindow::OpenFile(void){
    QFileDialog     *fd;
    QString         filter;

      fd = new QFileDialog();
      fd->setDirectory(sampleDir);
      FileName = fd->getOpenFileName(this,tr("Open Mesh Files"),sampleDir,"Mesh Files ( *.ply)", &filter);
      if (!FileName.isEmpty()){
        glwidget->setMeshFile(FileName);
        glwidget->loadMesh();
      }

}
开发者ID:njrizzo,项目名称:tucano,代码行数:13,代码来源:mainwindow.cpp


注:本文中的QFileDialog::setDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。