void QtDcm::openDicomdir() { this->clearDisplay(); d->mode = QtDcm::CD; // Open a QFileDialog for choosing a Dicomdir QFileDialog * dialog = new QFileDialog( this ); dialog->setFileMode ( QFileDialog::ExistingFile ); dialog->setDirectory ( QDir::home().dirName() ); dialog->setWindowTitle ( tr ( "Open dicomdir" ) ); QStringList filters; filters << "Dicomdir files (dicomdir* DICOMDIR*)"; filters << "Any files (*)"; dialog->setNameFilters(filters); QString fileName; if ( dialog->exec() ) { fileName = dialog->selectedFiles() [0]; } dialog->close(); if ( !fileName.isEmpty() ) // A file has been chosen { if (QString::compare(fileName, "dicomdir", Qt::CaseInsensitive)) { QtDcmManager::instance()->setDicomdir ( fileName ); this->loadPatientsFromDicomdir(); } } dialog->deleteLater(); }
void MainWindow::on_loadLstButton_clicked() { QFileDialog loader; std::string fileName = loader.getOpenFileName(this, tr("Open File"), "../lst files", tr("Files (*.lst*)") ).toStdString(); this->repaint(); loader.close(); if( fileName != "") glWidget->LoadLST(fileName); glWidget->GenerateMeshFromLST(); }
void MainWindow::on_actionLoadFolder_triggered() { QFileDialog dialog; dialog.setFileMode(QFileDialog::Directory); dialog.setOption(QFileDialog::ShowDirsOnly); int result = dialog.exec(); dialog.close(); if(result && dataManager) { dataManager->loadData(dialog.directory().path()); } }
void MainWindow::on_pushButton_select_clicked() { QFileDialog dialog; //QString fileName = dialog.getOpenFileName(this, tr("Open File"), QDir::currentPath(),tr("Videos(*.avi)")); QString fileName = dialog.getOpenFileName(this, tr("Open File"), "/home/ren/Videos",tr("Videos(*.avi *.avi.ln)")); if(fileName.isEmpty()) return; if(dialog.close() == true) process(fileName,false); }
void MainWindow::fileSelected(const QStringList &selected) { QFileDialog *dialog = qobject_cast<QFileDialog*>(QObject::sender()); Q_ASSERT(dialog); this->settings->setValue(QStringLiteral("paths/openFilter"), dialog->selectedNameFilter()); dialog->close(); dialog->deleteLater(); for(QString file : selected) this->openFile(file); }
void ShredDialog::onSelectButtonClicked() { // QString fileName=QFileDialog::getOpenFileName(0, tr("Select file"), QDir::homePath(), tr("All Files(*)")); QStringList fileNameList; QString fileName; QFileDialog* fd = new QFileDialog(this); fd->resize(500, 471); fd->setFilter(tr("Allfile(*)")); // fd->setFilter( "Allfile(*.*);;mp3file(*.mp3);;wmafile(*.wma);;wavefile(*.wav)"); fd->setViewMode(QFileDialog::List);//设置浏览模式,有 列表(list) 模式和 详细信息(detail)两种方式 if (fd->exec() == QDialog::Accepted) { fileNameList = fd->selectedFiles(); fileName = fileNameList[0]; select_edit->setText(fileName); } else fd->close(); }