MCPcopy Create free account
hub / github.com/ElementsProject/elements / getOpenFileName

Function getOpenFileName

src/qt/guiutil.cpp:349–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir,
350 const QString &filter,
351 QString *selectedSuffixOut)
352{
353 QString selectedFilter;
354 QString myDir;
355 if(dir.isEmpty()) // Default to user documents location
356 {
357 myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
358 }
359 else
360 {
361 myDir = dir;
362 }
363 /* Directly convert path to native OS path separators */
364 QString result = QDir::toNativeSeparators(QFileDialog::getOpenFileName(parent, caption, myDir, filter, &selectedFilter));
365
366 if(selectedSuffixOut)
367 {
368 /* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */
369 QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]");
370 QString selectedSuffix;
371 if(filter_re.exactMatch(selectedFilter))
372 {
373 selectedSuffix = filter_re.cap(1);
374 }
375 *selectedSuffixOut = selectedSuffix;
376 }
377 return result;
378}
379
380Qt::ConnectionType blockingGUIThreadConnection()
381{

Callers 1

gotoLoadPSBTMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected