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


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

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


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

示例1: on_toolButtonOPenGroup_clicked

void DialogConfigBooks::on_toolButtonOPenGroup_clicked()
{
    QFileDialog dlg;
QString homeDir=QDir::homePath () ;
    QString fn = dlg.getOpenFileName(0, tr("Open xml Files..."),
                                              homeDir   , trUtf8("ملف قائمة الكتب (group.xml );;xml (group.xml)"));
   qDebug()<<fn;
    if(!dlg.AcceptOpen)
     //   return;

    if (!fn.isEmpty())
    {

        QString groupPath=QDir::homePath()+"/.kirtasse/data/group.xml";
        QString groupPathNew=QDir::homePath()+"/.kirtasse/data/group.xml.old";
        QFile file;
        if(file.exists(groupPathNew))
            file.remove(groupPathNew);

        if(file.rename(groupPath,groupPathNew)) {
            if(file.copy(fn,groupPath)){
                Messages->treeChargeGroupe( ui->treeWidgetBooks,0,true);
                     ui->lineEditGroup->setText(fn);
                     ui->toolButtonGroupUpdat->setEnabled(true);
            }
        }
        if(ui->treeWidgetBooks->topLevelItemCount()<1)
           on_toolButtonGroupUpdat_clicked();
    }
}
开发者ID:kovax3,项目名称:elkirtasse,代码行数:30,代码来源:dialogconfigbooks.cpp

示例2: loadGameDialog

void FastQSPWindow::loadGameDialog() {
  QFileDialog dlg;
  QString filename = dlg.getOpenFileName(
      this, "Load Game", saveDir.absolutePath(), "QSP save-game (*.sav)");
  if (!filename.isEmpty())
    loadGame(filename);
}
开发者ID:ItalianSunglassMovie,项目名称:FastQSP,代码行数:7,代码来源:fastqspwindow.cpp

示例3: openFile

void FreeEMS_Loader::openFile() {

	QSettings loaderSettings(settingsFile, QSettings::IniFormat);
	loadDirectory = loaderSettings.value("lastDirectory").toString();
	QFileDialog fileDialog;
	fileDialog.setViewMode(QFileDialog::Detail);
	fileDialog.restoreGeometry(loaderSettings.value("lastOpenDialogGeo").toByteArray());
	QString qSNum;
	loadFileName = fileDialog.getOpenFileName(this, tr("Load s19 file"), loadDirectory, tr("s19 (*.s19)"));
	loaderSettings.setValue("lastOpenDialogGeo", fileDialog.saveGeometry());
	if (loadFileName.isNull()) {
		displayMessage(MESSAGE_ERROR, "no file selected");
		return;
	} else{
		loaderSettings.setValue("lastDirectory", loadFileName);
		loaderComms->setLoadFilename(loadFileName);
		displayMessage(MESSAGE_INFO,"Attempting to parse " + loadFileName);
		loaderComms->parseFile();
		if(loaderComms->numLoadableRecords() == 0){
			displayMessage(MESSAGE_ERROR, "no load-able records parsed");
		}else if(loaderComms->numBadSums()){
			displayMessage(MESSAGE_ERROR, "there are " + qSNum.setNum(loaderComms->numBadSums(), 10) + " records with bad checksums or lengths , loading will be disabled");
		} else {
			displayMessage(MESSAGE_INFO,"found " + 	qSNum.setNum(loaderComms->numLoadableRecords(), 10) +" load-able records in file");
			ui.pushLoad->setEnabled(true);
			m_fileLoaded = true;
		}
	}
}
开发者ID:FreeEMS,项目名称:freeems-loader,代码行数:29,代码来源:freeemsLoader.cpp

示例4: browseBtnClicked

void milxQtRegistrationAdvancedOptions::browseBtnClicked()
{
    QFileDialog fileOpener;
    fileOpener.setFileMode(QFileDialog::ExistingFile);
    QString filename = fileOpener.getOpenFileName(this, tr("Select File"));
    this->ui.lineParameterFile->setText(filename);
}
开发者ID:pleandre,项目名称:smili,代码行数:7,代码来源:milxQtRegistrationAdvancedOptions.cpp

示例5: tr

void
Dialog::on_loadImage_Btn_clicked()
{

    QFileDialog FileDialog;
    QString info=FileDialog.getOpenFileName(this,tr("Open Image"), "/home/nubot/ros_workspace/src/omni_vision/calibration/",
                                           tr("Image Files(*.jpg *.bmp *.png)"));
    if(!info.isEmpty())
    {
        std::string file_path=info.toStdString();
        cv::Mat img=cv::imread(file_path);
        cv::cvtColor(img,orignal_img_[0],CV_BGR2RGB);
        cv::cvtColor(orignal_img_[0],orignal_img_[2],CV_RGB2YUV);
        cv::cvtColor(orignal_img_[0],orignal_img_[1],CV_RGB2HSV);
        image[0]=QImage((const unsigned char*)(orignal_img_[0].data),
                         orignal_img_[0].cols,orignal_img_[0].rows,
                         orignal_img_[0].cols*orignal_img_[0].channels(),
                         QImage::Format_RGB888);
        segment_img_[0]=orignal_img_[0];
        is_screen_update_[0]=true;
        is_draw_Img_[0]=false;
        paint(image[0]);
        bufferImg_[0]=image[0];
        Img_selected_=0;
    }
}
开发者ID:mshicom,项目名称:nubot_ws,代码行数:26,代码来源:calibration_dialog.cpp

示例6: cargarSprites

void MainWindow::cargarSprites()
{

	QSettings settings("toglia3d","SpriteSceneViewer");
	QString rutaSpritesSetting = settings.value("rutaSprites", QString("/home")).toString();

	QFileDialog openDialog;
	//openDialog.exec();
	QString filtro = tr("*.2ds");
	rutaSprites = openDialog.getOpenFileName(
		this,
		tr("Abrir"),
		rutaSpritesSetting,
		filtro
	);

	if(!rutaSprites.isEmpty()){
		settings.setValue("rutaSprites",rutaSprites);
		mOgreWidget->CargarEscenario2d(rutaSprites.toStdString());

		QFile file(rutaSprites);
		if (file.open(QIODevice::ReadOnly)) {
			QDomDocument document;
			if (document.setContent(&file)) {
				DomModel *newModel = new DomModel(document, this);
				ui.arbolXML->setModel(newModel);
			}
			file.close();
		}
	}
}
开发者ID:toglia3d,项目名称:OgreSpriteEditor,代码行数:31,代码来源:MainWindow.cpp

示例7: teamFileOpen

void MainWindow::teamFileOpen(int TeamNumber)
{
	statusBar()->message(tr("Opening file..."));
	QFileDialog *TempFileDialog;
	TempFileDialog = new QFileDialog;
	TempFileDialog->setMode(QFileDialog::Directory);
	QString FileName = TempFileDialog->getOpenFileName(0,0,this,0,0);
	if (!FileName.isEmpty()) {
		if (GABotDoc->loadTeamFromFile(FileName,TeamNumber)) {
			if (TeamNumber) {
				statusBar()->message(tr("Loaded file "+FileName+" into Team B."), 5000);
				TeamBFileSave->setEnabled(TRUE);
			} else {
				statusBar()->message(tr("Loaded file "+FileName+" into Team A."), 5000);
				TeamAFileSave->setEnabled(TRUE);
			}
		} else {
			QMessageBox::warning(this,tr("Invalid file format"),
				tr("\nThe selected file is not a GA Bot XML file, you idiot."));
			statusBar()->message(tr("Opening aborted"), 1000);
		}
	} else {
		statusBar()->message(tr("Opening aborted"), 1000);
	}
	delete TempFileDialog;
}
开发者ID:edlau,项目名称:GABot,代码行数:26,代码来源:mainwindow.cpp

示例8: 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

示例9: load

void QtHistoTfuncPixmap::load(void)
{
	QFileDialog* fd = new QFileDialog(0);

	QString fn = fd->getOpenFileName(currentworkingdir, "*.tf2", this );
	loadfile(fn);
	delete fd;
}
开发者ID:ut666,项目名称:VolViewer,代码行数:8,代码来源:QtHistoTfuncPixmap.cpp

示例10: on_cmdOpenCryptFile_clicked

void ImportConfig::on_cmdOpenCryptFile_clicked()
{
    QFileDialog certFileDialog;
    QString filename = certFileDialog.getOpenFileName(this, tr("Find import file"), QApplication::applicationDirPath(), tr("Import files (*.crypt)"));
    if (!filename.isEmpty()) {
        m_ui->txtImportPath->setText(filename);
    }
}
开发者ID:OldFrank,项目名称:openvpn-client,代码行数:8,代码来源:importconfig.cpp

示例11: chooseTextFile

void EditNoteDialogue::chooseTextFile()
{
    QFileDialog dialog;
    QString file = dialog.getOpenFileName(this,tr("Choose a picture"));

    ui->textEdit->setText("define_text_file_note:"+file);
    ui->textEdit->setFocus();
    ui->textEdit->moveCursor (QTextCursor::End);
}
开发者ID:petko10,项目名称:misli,代码行数:9,代码来源:editnotedialogue.cpp

示例12: LoadFilePrompt

void QSimTestGUI::LoadFilePrompt(QString directory_key,QString filter){
  QFileDialog f;
  QString openDir = ini->value(directory_key,".").toString();
  QString filename = f.getOpenFileName(0,"Open File",openDir,filter);
  if(!filename.isEmpty()){
    ini->setValue(directory_key,QFileInfo(filename).absolutePath());
    LoadFile(filename);
  }
}
开发者ID:arocchi,项目名称:Klampt,代码行数:9,代码来源:qsimtestgui.cpp

示例13: on_actionOpen_Background_triggered

void MainWindow::on_actionOpen_Background_triggered()
{
    QFileDialog dialog;
    QString fileName = dialog.getOpenFileName(this, tr("Open File"), "/home/ren/Videos", tr("Images(*.png *.jpg *.tiff)"));
    if(fileName.isEmpty())
        return;
    background = new QImage(fileName);
    return;
}
开发者ID:daoyuan-ren,项目名称:DevEnvt,代码行数:9,代码来源:mainwindow.cpp

示例14: on_cmdOpenOvpnFile_clicked

void ImportConfig::on_cmdOpenOvpnFile_clicked()
{
    QFileDialog certFileDialog;
    QString filename (certFileDialog.getOpenFileName(this, QObject::tr("Find ovpn file"), AppFunc::getAppSavePath(), QObject::tr("OpenVPN configs (*.ovpn)")));

    if (!filename.isEmpty()) {
        m_ui->txtExistingOvpn->setText(filename);
    }
}
开发者ID:OldFrank,项目名称:openvpn-client,代码行数:9,代码来源:importconfig.cpp

示例15: importSessions

void MainWindow::importSessions(){
    QFileDialog dialog;
    QString fileName = dialog.getOpenFileName(this,tr("select file to open"),"","Archiev Files(*.saz *.zip)");
    QuaZip zip(fileName);
    if(!zip.open(QuaZip::mdUnzip)){
        qDebug()<<"cannot open "<<fileName;
        return;
    }
    QuaZipFileInfo info;
    QuaZipFile file(&zip);

    RyPipeData_ptr pipeData;

    QString name;
    for (bool more = zip.goToFirstFile(); more; more = zip.goToNextFile()) {

        if (!zip.getCurrentFileInfo(&info)) {
            qWarning("testRead(): getCurrentFileInfo(): %d\n", zip.getZipError());
            return;
        }

        if (!file.open(QIODevice::ReadOnly)) {
            qWarning("testRead(): file.open(): %d", file.getZipError());
            return;
        }

        name = file.getActualFileName();
        QByteArray ba = file.readAll();
        if(name.endsWith("_c.txt")){
            //pipeData.clear();
            pipeData = RyPipeData_ptr(new RyPipeData(0,0));
            pipeData->isImported = true;
            pipeData->parseRequest(&ba);
            onNewPipe(pipeData);
        }else if(name.endsWith("_s.txt")){
            pipeData->parseResponse(&ba);
            onPipeUpdate(pipeData);
            pipeData.clear();
        }

        if (file.getZipError() != UNZ_OK) {
            qWarning("testRead(): file.getFileName(): %d", file.getZipError());
            return ;
        }

        file.close();

        if (file.getZipError() != UNZ_OK) {
            qWarning("testRead(): file.close(): %d", file.getZipError());
            return ;
        }

    }

    zip.close();

}
开发者ID:feidianbo,项目名称:Rythem,代码行数:57,代码来源:mainwindow.cpp


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