4#define QT_NO_URL_CAST_FROM_STRING
7#include <private/qwidgetitemdata_p.h>
11#include <private/qapplication_p.h>
12#include <private/qguiapplication_p.h>
15#include <qactiongroup.h>
17#if QT_CONFIG(shortcut)
18# include <qshortcut.h>
24#if QT_CONFIG(messagebox)
28#if QT_CONFIG(settings)
32#if QT_CONFIG(mimetype)
35#if QT_CONFIG(regularexpression)
40#include "ui_qfiledialog.h"
44#elif defined(Q_OS_WIN)
45# include <QtCore/qt_windows.h>
48#include <private/qwasmlocalfileaccess_p.h>
312#if QT_CONFIG(shortcut)
313# include <qshortcut.h>
346 args.caption = caption;
359 setOptions(
args.options);
360 selectFile(
args.selection);
368#if QT_CONFIG(settings)
391 if (!
d->nativeDialogInUse)
392 d->qFileDialogUi->sidebar->setUrls(urls);
402 return (
d->nativeDialogInUse ?
QList<QUrl>() :
d->qFileDialogUi->sidebar->urls());
424 if (
d->usingWidgets()) {
425 stream <<
d->qFileDialogUi->splitter->saveState();
426 stream <<
d->qFileDialogUi->sidebar->urls();
432 stream << *lastVisitedDir();
433 if (
d->usingWidgets())
434 stream <<
d->qFileDialogUi->treeView->header()->saveState();
459 QUrl currentDirectory;
473 QString currentDirectoryString;
474 stream >> currentDirectoryString;
477 stream >> currentDirectory;
482 setDirectoryUrl(lastVisitedDir()->isEmpty() ? currentDirectory : *lastVisitedDir());
485 if (!
d->usingWidgets())
488 return d->restoreWidgetState(
history, -1);
498 d->retranslateWindowTitle();
499 d->retranslateStrings();
510 currentHistoryLocation(-1),
514 useDefaultCaption(true),
566 q->setWindowTitle(QFileDialog::tr(
"Find Directory"));
568 q->setWindowTitle(QFileDialog::tr(
"Open"));
570 q->setWindowTitle(QFileDialog::tr(
"Save As"));
577 *lastVisitedDir() =
dir;
591 switch (q_func()->fileMode()) {
612 if (saveAsOnFolder) {
618 switch (
q->fileMode()) {
625 QFileDialog::tr(
"&Open") :
626 QFileDialog::tr(
"&Save"));
649#if QT_CONFIG(proxymodel)
651 abstractModel = proxyModel;
654 for (
int i = 1;
i < total; ++
i) {
674 if (
files.size() == 1)
691 return strcmp(QFileDialog::staticMetaObject.
className(),
q->metaObject()->className()) == 0;
718 const QFileDialog::Options previousOptions =
options();
719 if (!(previousOptions &
option) != !on)
764 d->options->setOptions(QFileDialogOptions::FileDialogOptions(
int(
options)));
767 d->nativeDialogInUse =
false;
771 if (
d->usingWidgets()) {
776 d->model->setReadOnly(ro);
777 d->qFileDialogUi->newFolderButton->setEnabled(!ro);
778 d->renameAction->setEnabled(!ro);
779 d->deleteAction->setEnabled(!ro);
807 return QFileDialog::Options(
int(
d->options->options()));
825 d->signalToDisconnectOnClose =
signal;
826 d->receiverToDisconnectOnClose = receiver;
827 d->memberToDisconnectOnClose = member;
845 if (
d->canBeNativeDialog()){
846 if (
d->setNativeDialogVisible(
visible)){
850#if QT_CONFIG(fscompleter)
852 if (!
d->nativeDialogInUse)
853 d->completer->setModel(
nullptr);
858#if QT_CONFIG(fscompleter)
859 if (!
d->nativeDialogInUse) {
860 if (
d->proxyModel !=
nullptr)
861 d->completer->setModel(
d->proxyModel);
863 d->completer->setModel(
d->model);
870 d->qFileDialogUi->fileNameEdit->setFocus();
921 if (!
d->usingWidgets()) {
922 d->setDirectory_sys(newDirUrl);
925 if (
d->rootPath() == newDirectory)
928 if (!
d->nativeDialogInUse) {
930 if (root !=
d->rootIndex()) {
931#if QT_CONFIG(fscompleter)
933 d->completer->setCompletionPrefix(newDirectory);
935 d->completer->setCompletionPrefix(newDirectory + u
'/');
937 d->setRootIndex(root);
939 d->qFileDialogUi->listView->selectionModel()->clear();
949 if (
d->nativeDialogInUse) {
953 return d->rootPath();
982 if (
d->nativeDialogInUse)
987 qWarning(
"Non-native QFileDialog supports only local files");
998 if (
d->nativeDialogInUse)
999 return d->directory_sys();
1008#if defined(Q_OS_WIN)
1012#elif defined(Q_OS_MACOS)
1034 ||
path.at(0) == u
'/'
1053 if (!
d->usingWidgets()) {
1056 url =
d->options->initialDirectory();
1058 if (!
path.endsWith(u
'/'))
1064 d->selectFile_sys(
url);
1073 if (
d->model->rootPath() != filenamePath)
1078 d->qFileDialogUi->listView->selectionModel()->clear();
1079 if (!
isVisible() || !
d->lineEdit()->hasFocus())
1097 if (
d->nativeDialogInUse)
1098 d->selectFile_sys(
url);
1102 qWarning(
"Non-native QFileDialog supports only local files");
1108#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_WASM)
1111 long bufSize = ::sysconf(_SC_GETPW_R_SIZE_MAX);
1116# if defined(Q_OS_SOLARIS) && (_POSIX_C_SOURCE - 0 < 199506L)
1117 tmpPw = getpwnam_r(userName.
constData(), &pw,
buf.data(),
buf.size());
1119 err = getpwnam_r(userName.
constData(), &pw,
buf.data(),
buf.size(), &tmpPw);
1125 passwd *pw = getpwnam(userName.
constData());
1134 if (!
path.startsWith(u
'~'))
1137 if (
path.size() == 1)
1145#if defined(Q_OS_VXWORKS) || defined(Q_OS_INTEGRITY)
1150 const qsizetype userNameLen = sepIndex != -1 ? sepIndex - strlen(
"~")
1153 QString homePath = homeDirFromPasswdEntry(
path, userName);
1156 return homePath + sv.
sliced(sepIndex);
1175 files << qt_tildeExpansion(editText);
1184 for (
int i=0;
i<tokens.size(); ++
i) {
1219 files.reserve(typedFilesList.size());
1230 for (
int i=0;
i<filesToFix.size(); ++
i) {
1236 name += u
'.' + defaultSuffix;
1245 if (!
path.endsWith(u
'/'))
1261 if (!defaultSuffix.
isEmpty()) {
1285 const QList<QUrl> userSelectedFiles =
d->userSelectedFiles();
1286 files.reserve(userSelectedFiles.
size());
1287 for (
const QUrl &
file : userSelectedFiles)
1290 if (
files.isEmpty() &&
d->usingWidgets()) {
1309 if (
d->nativeDialogInUse) {
1310 return d->userSelectedFiles();
1314 urls.
reserve(selectedFileList.size());
1365#if QT_CONFIG(regularexpression)
1368 strippedFilters.reserve(
filters.size());
1372 if (
match.hasMatch())
1373 filterName =
match.captured(1);
1374 strippedFilters.append(filterName.
simplified());
1376 return strippedFilters;
1406 cleanedFilters.reserve(
filters.size());
1408 cleanedFilters <<
filter.simplified();
1410 d->options->setNameFilters(cleanedFilters);
1412 if (!
d->usingWidgets())
1415 d->qFileDialogUi->fileTypeCombo->clear();
1416 if (cleanedFilters.isEmpty())
1422 d->qFileDialogUi->fileTypeCombo->addItems(cleanedFilters);
1424 d->_q_useNameFilter(0);
1435 return d_func()->options->nameFilters();
1449 d->options->setInitiallySelectedNameFilter(
filter);
1450 if (!
d->usingWidgets()) {
1451 d->selectNameFilter_sys(
filter);
1458 i =
d->qFileDialogUi->fileTypeCombo->findText(
filters.first());
1460 i =
d->qFileDialogUi->fileTypeCombo->findText(
filter);
1463 d->qFileDialogUi->fileTypeCombo->setCurrentIndex(
i);
1464 d->_q_useNameFilter(
d->qFileDialogUi->fileTypeCombo->currentIndex());
1478 if (!
d->usingWidgets())
1479 return d->selectedNameFilter_sys();
1481 return d->qFileDialogUi->fileTypeCombo->currentText();
1494 if (
d->usingWidgets())
1495 return d->model->filter();
1496 return d->options->filter();
1512 if (!
d->usingWidgets()) {
1521#if QT_CONFIG(mimetype)
1527 if (
mime.isValid()) {
1528 if (
mime.isDefault()) {
1529 return QFileDialog::tr(
"All files (*)");
1531 const QString patterns =
mime.globPatterns().join(u
' ');
1532 return mime.comment() +
" ("_L1 + patterns + u
')';
1565 d->options->setMimeTypeFilters(
filters);
1576 return d_func()->options->mimeTypeFilters();
1585void QFileDialog::selectMimeTypeFilter(
const QString &
filter)
1588 d->options->setInitiallySelectedMimeTypeFilter(
filter);
1592 if (!
d->usingWidgets()) {
1593 d->selectMimeTypeFilter_sys(
filter);
1594 if (
d->selectedMimeTypeFilter_sys().isEmpty() && !filterForMime.
isEmpty()) {
1597 }
else if (!filterForMime.
isEmpty()) {
1612 if (!
d->usingWidgets())
1613 mimeTypeFilter =
d->selectedMimeTypeFilter_sys();
1615#if QT_CONFIG(mimetype)
1616 if (mimeTypeFilter.
isNull() && !
d->options->mimeTypeFilters().isEmpty()) {
1618 const auto mimeTypes =
d->options->mimeTypeFilters();
1619 for (
const auto &
mimeType: mimeTypes) {
1623 if (
filter == nameFilter) {
1631 return mimeTypeFilter;
1647 if (!
d->usingWidgets())
1650 d->_q_showDetailsView();
1652 d->_q_showListView();
1658 if (!
d->usingWidgets())
1682 if (!
d->usingWidgets())
1685 d->retranslateWindowTitle();
1693 d->qFileDialogUi->listView->setSelectionMode(selectionMode);
1694 d->qFileDialogUi->treeView->setSelectionMode(selectionMode);
1696 d->model->setFilter(
d->filterForMode(
filter()));
1699 d->qFileDialogUi->fileTypeCombo->clear();
1700 d->qFileDialogUi->fileTypeCombo->addItem(
tr(
"Directories"));
1701 d->qFileDialogUi->fileTypeCombo->setEnabled(
false);
1703 d->updateFileNameLabel();
1704 d->updateOkButtonText();
1706 d->_q_updateOkButton();
1712 return static_cast<FileMode>(
d->options->fileMode());
1731 if (!
d->usingWidgets())
1735 d->qFileDialogUi->buttonBox->button(
button)->setEnabled(
false);
1736 d->_q_updateOkButton();
1738 d->qFileDialogUi->lookInCombo->setEditable(
false);
1740 d->retranslateWindowTitle();
1759 d->options->setSupportedSchemes(schemes);
1764 return d_func()->options->supportedSchemes();
1789#if defined(Q_OS_UNIX)
1791#elif defined(Q_OS_WIN)
1794 if (::GetVolumeInformation(
reinterpret_cast<const wchar_t *
>(drive.
utf16()), NULL, 0, NULL, &
maxLength, NULL, NULL, 0) ==
false)
1820 if (idx.isValid() && !
qFileDialogUi->listView->selectionModel()->isSelected(idx))
1829 return static_cast<AcceptMode>(
d->options->acceptMode());
1846 d->options->setDefaultSuffix(suffix);
1852 return d->options->defaultSuffix();
1862 if (
d->usingWidgets())
1863 d->qFileDialogUi->lookInCombo->setHistory(
paths);
1887 if (!
d->usingWidgets())
1889 QStringList currentHistory =
d->qFileDialogUi->lookInCombo->history();
1892 if (!currentHistory.contains(newHistory))
1893 currentHistory << newHistory;
1894 return currentHistory;
1918 if (!
d->usingWidgets())
1920 d->qFileDialogUi->listView->setItemDelegate(delegate);
1921 d->qFileDialogUi->treeView->setItemDelegate(delegate);
1930 if (!
d->usingWidgets())
1932 return d->qFileDialogUi->listView->itemDelegate();
1941 if (!
d->usingWidgets())
1943 d->model->setIconProvider(provider);
1945 d->qFileDialogUi->sidebar->setUrls(
d->qFileDialogUi->sidebar->urls());
1956 return d->model->iconProvider();
2006 if (!
d->usingWidgets())
2011 return d->qFileDialogUi->lookInLabel->text();
2013 return d->qFileDialogUi->fileNameLabel->text();
2015 return d->qFileDialogUi->fileTypeLabel->text();
2088 selectedFilter,
options, schemes);
2132 args.caption = caption;
2139 if (selectedFilter && !selectedFilter->
isEmpty())
2247 args.caption = caption;
2254 if (selectedFilter && !selectedFilter->
isEmpty())
2285 auto openFileImpl = std::make_shared<std::function<
void(
void)>>();
2288 *openFileImpl = [=]()
mutable {
2291 fileOpenCompleted(
fileName, fileContent);
2292 openFileImpl.reset();
2295 auto acceptFile = [&](uint64_t
size,
const std::string
name) ->
char * {
2296 const uint64_t twoGB = 1ULL << 31;
2302 return fileContent.
data();
2305 fileOpenCompleted(
fileName, fileContent);
2306 openFileImpl.reset();
2323 fileContent = selectedFile.
readAll();
2325 fileOpenCompleted(
fileName, fileContent);
2364 selectedFile.
write(fileContent);
2431 selectedFilter,
options, schemes);
2475 args.caption = caption;
2483 if (selectedFilter && !selectedFilter->
isEmpty())
2542 const QUrl selectedUrl =
2585 args.caption = caption;
2624 const QUrl lastVisited = *lastVisitedDir();
2625 if (lastVisited !=
url)
2655 if (
d->receiverToDisconnectOnClose) {
2657 d->receiverToDisconnectOnClose,
d->memberToDisconnectOnClose);
2658 d->receiverToDisconnectOnClose =
nullptr;
2660 d->memberToDisconnectOnClose.clear();
2661 d->signalToDisconnectOnClose.clear();
2666#if QT_CONFIG(messagebox)
2668 const QString msg = QFileDialog::tr(
"%1 already exists.\nDo you want to replace it?").
arg(
fileName);
2670 const auto res = B::warning(
q,
q->windowTitle(), msg, B::Yes | B::No, B::No);
2671 return res == B::Yes;
2678#if QT_CONFIG(messagebox)
2681 ? QFileDialog::tr(
"%1\nDirectory not found.\n"
2682 "Please verify the correct directory name was given.")
2684 "correct file name was given.");
2696 if (!
d->usingWidgets()) {
2700 d->_q_emitUrlsSelected(urls);
2701 if (urls.
size() == 1)
2702 d->_q_emitUrlSelected(urls.
first());
2708 if (
files.isEmpty())
2710 QString lineEditText =
d->lineEdit()->text();
2713 if (lineEditText ==
".."_L1) {
2714 d->_q_navigateToParent();
2716 d->lineEdit()->selectAll();
2732 d->emitFilesSelected(
files);
2747 const long maxNameLength =
d->maxNameLength(
info.
path());
2777 d->lineEdit()->clear();
2781 d->emitFilesSelected(
files);
2787#if QT_CONFIG(settings)
2788void QFileDialogPrivate::saveSettings()
2801 historyUrls.reserve(history.size());
2806 const QMetaEnum &viewModeMeta =
q->metaObject()->enumerator(
q->metaObject()->indexOfEnumerator(
"ViewMode"));
2811bool QFileDialogPrivate::restoreFromSettings()
2819 q->setDirectoryUrl(lastVisitedDir()->isEmpty() ?
settings.
value(
"lastVisited").
toUrl() : *lastVisitedDir());
2822 const QMetaEnum &viewModeMeta =
q->metaObject()->enumerator(
q->metaObject()->indexOfEnumerator(
"ViewMode"));
2837 for (
const QString &urlStr : urlStrings) {
2850 if (splitterPosition >= 0) {
2852 splitterSizes.
append(splitterPosition);
2868 static const int MaxHistorySize = 5;
2869 if (history.size() > MaxHistorySize)
2870 history.erase(history.begin(), history.end() - MaxHistorySize);
2871 q->setHistory(history);
2879#if QT_CONFIG(proxymodel)
2881 abstractModel = proxyModel;
2884 for (
int i = 1;
i < total; ++
i)
2901 q->setWindowTitle(
args.caption);
2910 q->setNameFilter(
args.filter);
2912 const bool dontStoreDir = !
args.directory.isValid() && !lastVisitedDir()->isValid();
2913 q->setDirectoryUrl(
args.directory);
2915 lastVisitedDir()->
clear();
2916 if (
args.directory.isLocalFile())
2917 q->selectFile(
args.selection);
2919 q->selectUrl(
args.directory);
2921#if QT_CONFIG(settings)
2924 if (!restoreFromSettings()) {
2930#if defined(Q_EMBEDDED_SMALLSCREEN)
2937 const QSize sizeHint =
q->sizeHint();
2939 q->resize(sizeHint);
2957 Qt::WindowStates preState =
q->windowState();
2967 model->d_func()->disableRecursiveSort =
true;
2979 initialBookmarks <<
QUrl(
"file:"_L1)
2996#ifndef QT_NO_SHORTCUT
2999#if QT_CONFIG(fscompleter)
3028#ifndef QT_NO_SHORTCUT
3049#if QT_CONFIG(proxymodel)
3051 abstractModel = proxyModel;
3057 treeHeader->addAction(showHeader);
3067#ifndef QT_NO_SHORTCUT
3083#if QT_CONFIG(settings)
3086 if (!restoreFromSettings()) {
3096 q->setOptions(
static_cast<QFileDialog::Options
>(
static_cast<int>(
options->
options())));
3100#if QT_CONFIG(mimetype)
3111 if (initiallySelectedFiles.size() == 1)
3112 q->selectFile(initiallySelectedFiles.first().fileName());
3113 for (
const QUrl &
url : initiallySelectedFiles)
3118 q->resize(preSize.
isValid() ? preSize :
q->sizeHint());
3119 q->setWindowState(preState);
3125 QActionGroup *actionGroup = qobject_cast<QActionGroup*>(
q->sender());
3130#if QT_CONFIG(proxymodel)
3146 if (!
d->usingWidgets())
3148 if ((!proxyModel && !
d->proxyModel)
3149 || (proxyModel ==
d->proxyModel))
3153 if (
d->proxyModel) {
3161 if (proxyModel !=
nullptr) {
3163 d->proxyModel = proxyModel;
3165 d->qFileDialogUi->listView->setModel(
d->proxyModel);
3166 d->qFileDialogUi->treeView->setModel(
d->proxyModel);
3167#if QT_CONFIG(fscompleter)
3168 d->completer->setModel(
d->proxyModel);
3169 d->completer->proxyModel =
d->proxyModel;
3174 d->proxyModel =
nullptr;
3175 d->qFileDialogUi->listView->setModel(
d->model);
3176 d->qFileDialogUi->treeView->setModel(
d->model);
3177#if QT_CONFIG(fscompleter)
3178 d->completer->setModel(
d->model);
3179 d->completer->sourceModel =
d->model;
3180 d->completer->proxyModel =
nullptr;
3186 d->qFileDialogUi->treeView->setSelectionModel(
d->qFileDialogUi->listView->selectionModel());
3188 d->setRootIndex(idx);
3193 this,
SLOT(_q_selectionChanged()));
3206 return d->proxyModel;
3266#ifndef QT_NO_SHORTCUT
3270 q->addAction(goHomeAction);
3276#ifndef QT_NO_SHORTCUT
3280 q->addAction(goToParent);
3314 item.selection.clear();
3315 const auto selectedIndexes =
qFileDialogUi->listView->selectionModel()->selectedRows();
3316 for (
const auto &
index : selectedIndexes)
3351 q->setDirectory(historyItem.
path);
3364 auto selectionModel =
view->selectionModel();
3372 selectionModel->select(*
it,
flags);
3418 newDirectory =
dir.absolutePath();
3420 q->setDirectory(newDirectory);
3421 emit q->directoryEntered(newDirectory);
3434 QString newFolderString = QFileDialog::tr(
"New Folder");
3435 QString folderName = newFolderString;
3446 if (!
index.isValid())
3450 if (
index.isValid()) {
3498 if (
index.isValid()) {
3555 if (!
index.isValid())
3562#if QT_CONFIG(messagebox)
3565 QFileDialog::tr(
"'%1' is write protected.\nDo you want to delete it anyway?")
3570 QFileDialog::tr(
"Are you sure you want to delete '%1'?")
3576 if (!
index.isValid())
3586#if QT_CONFIG(messagebox)
3588 QFileDialog::tr(
"Could not delete directory."));
3600 qFileDialogUi->listView->selectionModel()->clearSelection();
3605 if (multipleFiles.size() > 0) {
3608 for (
const auto &
file : multipleFiles) {
3613 for (
const auto &newFile : std::as_const(newFiles))
3617 for (
const auto &oldFile : std::as_const(oldFiles))
3635 bool enableButton =
true;
3636 bool isOpenDirectory =
false;
3647 if (
files.isEmpty()) {
3648 enableButton =
false;
3649 }
else if (lineEditText ==
".."_L1) {
3650 isOpenDirectory =
true;
3659 enableButton =
false;
3674 if (lineEditText.
contains(
".."_L1)) {
3679 if (fileDir ==
q->directory().canonicalPath() &&
fileName.isEmpty()) {
3680 enableButton =
false;
3684 isOpenDirectory =
true;
3685 enableButton =
true;
3701 enableButton =
false;
3705 isOpenDirectory =
true;
3742 q->setDirectory(
path);
3768 #if QT_CONFIG(messagebox)
3775 if (!
index.isValid())
3778 path2 =
index.
data(UrlRole).toUrl().toLocalFile();
3787#if QT_CONFIG(messagebox)
3789 QString message = QFileDialog::tr(
"%1\nDirectory not found.\nPlease verify the "
3790 "correct directory name was given.");
3805 if (
index == nameFilters.size()) {
3814 QString newNameFilterExtension;
3815 if (newNameFilters.size() > 0)
3820 if (!fileNameExtension.
isEmpty() && !newNameFilterExtension.
isEmpty()) {
3821 const qsizetype fileNameExtensionLength = fileNameExtension.
size();
3823 fileNameExtensionLength, newNameFilterExtension);
3845 for (
const auto &
index : indexes) {
3848 allFiles.append(
index.data().toString());
3850 if (allFiles.size() > 1)
3852 allFiles.replace(
i,
QString(u
'"' + allFiles.at(
i) + u
'"'));
3855 QString finalFiles = allFiles.join(u
' ');
3870 QDir::Filters dirFilters =
q->filter();
3872 q->setFilter(dirFilters);
3886 ||
qFileDialogUi->treeView->selectionModel()->hasSelection()
3904 if (
file.isLocalFile())
3905 emit q->fileSelected(
file.toLocalFile());
3914 if (
file.isLocalFile())
3915 localFiles.append(
file.toLocalFile());
3916 if (!localFiles.isEmpty())
3917 emit q->filesSelected(localFiles);
3924 if (
file.isLocalFile())
3925 emit q->currentChanged(
file.toLocalFile());
3948#if QT_CONFIG(shortcut)
3955 switch (
event->key()) {
3960#ifdef QT_KEYPAD_NAVIGATION
3961 if (QApplicationPrivate::keypadNavigationEnabled())
3979 if (
string.
size() > 1 &&
string.startsWith(u
'$')) {
3983 if (
string.
size() > 2 &&
string.startsWith(u
'%') &&
string.endsWith(u
'%')) {
4000 if (
model()->rowCount() > 1)
4019 for (
int i = 0;
i < m_history.size(); ++
i) {
4024 if (urls.
size() > 0) {
4028 model()->
setData(idx, QFileDialog::tr(
"Recent Places"));
4031 Qt::ItemFlags
flags =
m->flags(idx);
4035 urlModel->
addUrls(urls, -1,
false);
4070#if QT_CONFIG(draganddrop)
4071 setDragDropMode(QAbstractItemView::InternalMove);
4083#ifdef QT_KEYPAD_NAVIGATION
4107#if QT_CONFIG(draganddrop)
4108 setDragDropMode(QAbstractItemView::InternalMove);
4114#ifdef QT_KEYPAD_NAVIGATION
4139#ifdef QT_KEYPAD_NAVIGATION
4146#if QT_CONFIG(shortcut)
4150#if QT_CONFIG(shortcut)
4156#if QT_CONFIG(fscompleter)
4167 if (!currentLocation.
isEmpty() &&
path.startsWith(currentLocation)) {
4168#if defined(Q_OS_UNIX)
4170 return path.remove(0, currentLocation.
size());
4172 if (currentLocation.
endsWith(u
'/'))
4173 return path.remove(0, currentLocation.
size());
4175 return path.remove(0, currentLocation.
size()+1);
4187#if defined(Q_OS_WIN)
4188 if (pathCopy ==
"\\"_L1 || pathCopy ==
"\\\\"_L1)
4190 QString doubleSlash(
"\\\\"_L1);
4192 pathCopy = pathCopy.
mid(2);
4194 doubleSlash.
clear();
4195#elif defined(Q_OS_UNIX)
4197 QString tildeExpanded = qt_tildeExpansion(pathCopy);
4198 if (tildeExpanded != pathCopy) {
4206 pathCopy = std::move(tildeExpanded);
4210#if defined(Q_OS_WIN)
4212 if (!doubleSlash.isEmpty() && !parts.isEmpty())
4213 parts[0].prepend(doubleSlash);
4218 if (pathCopy[0] ==
sep)
4222#if defined(Q_OS_WIN)
4223 bool startsFromRoot = !parts.isEmpty() && parts[0].endsWith(u
':');
4225 bool startsFromRoot = pathCopy[0] ==
sep;
4227 if (parts.size() == 1 || (parts.size() > 1 && !startsFromRoot)) {
4234#if defined(Q_OS_WIN)
4235 if (currentLocation.
endsWith(u
':'))
4240 while (!currentLocationList.isEmpty() && parts.size() > 0 && parts.at(0) ==
".."_L1) {
4241 parts.removeFirst();
4242 currentLocationList.removeLast();
4244 if (!currentLocationList.isEmpty() && currentLocationList.constLast().isEmpty())
4245 currentLocationList.removeLast();
4246 return currentLocationList + parts;
4257#include "moc_qfiledialog.cpp"
@ DontUseCustomDirectoryIcons
virtual void setOptions(Options)
Sets options that affect the icon provider.
virtual Options options() const
Returns all the options that affect the icon provider.
The QAbstractItemDelegate class is used to display and edit data items from a model.
virtual Q_INVOKABLE QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data for the given role and section in the header with the specified orientation.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual Q_INVOKABLE bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
virtual Q_INVOKABLE QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index.
The QAbstractItemView class provides the basic functionality for item view classes.
SelectionMode
This enum indicates how the view responds to user selections:
void setEditTriggers(EditTriggers triggers)
void setTextElideMode(Qt::TextElideMode mode)
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
void keyPressEvent(QKeyEvent *event) override
This function is called with the given event when a key event is sent to the widget.
void edit(const QModelIndex &index)
Starts editing the item corresponding to the given index if it is editable.
virtual int sizeHintForRow(int row) const
Returns the height size hint for the specified row or -1 if there is no model.
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting,...
QAbstractItemModel * sourceModel
the source model of this proxy model.
virtual void setSourceModel(QAbstractItemModel *sourceModel)
Sets the given sourceModel to be processed by the proxy model.
The QActionGroup class groups actions together.
QList< QAction * > actions() const
Returns the list of this groups's actions.
void setExclusive(bool)
Enable or disable the group exclusion checking.
The QAction class provides an abstraction for user commands that can be added to different user inter...
void setText(const QString &text)
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
QByteArray sliced(qsizetype pos) const
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
virtual void initStyleOption(QStyleOptionComboBox *option) const
Initialize option with the values from this QComboBox.
@ AdjustToContentsOnFirstShow
virtual void setModel(QAbstractItemModel *model)
Sets the model to be model.
QAbstractItemModel * model() const
Returns the model used by the combobox.
virtual void showPopup()
Displays the list of items in the combobox.
void setCurrentIndex(int index)
QString completionPrefix
the completion prefix used to provide completions.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
\inmodule QtCore\reentrant
The QDialog class is the base class of dialog windows.
virtual int exec()
Shows the dialog as a \l{QDialog::Modal Dialogs}{modal dialog}, blocking until the user closes it.
DialogCode
The value returned by a modal dialog.
virtual void done(int)
Closes the dialog and sets its result code to r.
virtual void accept()
Hides the modal dialog and sets the result code to Accepted.
static bool isRelativePath(const QString &path)
Returns true if path is relative; returns false if it is absolute.
QString path() const
Returns the path.
static QDir current()
Returns the application's current directory.
static QChar separator()
Returns the native directory separator: "/" under Unix and "\\" under Windows.
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
static QString toNativeSeparators(const QString &pathName)
static QString homePath()
Returns the absolute path of the user's home directory.
bool isEmpty(Filters filters=Filters(AllEntries|NoDotAndDotDot)) const
Returns whether the directory is empty.
static QString currentPath()
Returns the absolute path of the application's current directory.
QCompleter that can deal with QFileSystemModel.
QStringList splitPath(const QString &path) const override
Splits the given path into strings that are used to match at each level in the model().
QString pathFromIndex(const QModelIndex &index) const override
Returns the path for the given index.
QAbstractProxyModel * proxyModel
QFileSystemModel * sourceModel
void setHistory(const QStringList &paths)
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
void showPopup() override
Displays the list of items in the combobox.
void paintEvent(QPaintEvent *) override
\reimp
void keyPressEvent(QKeyEvent *e) override
FIXME: this is a hack to avoid propagating key press events to the dialog and from there to the "Ok" ...
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
QSize sizeHint() const override
void keyPressEvent(QKeyEvent *e) override
QStringList mimeTypeFilters() const
QList< QUrl > initiallySelectedFiles() const
void setHistory(const QStringList &paths)
bool isLabelExplicitlySet(DialogLabel label)
QDir::Filters filter() const
QString initiallySelectedNameFilter() const
void setWindowTitle(const QString &)
QString labelText(DialogLabel label) const
void setNameFilters(const QStringList &filters)
AcceptMode acceptMode() const
QString defaultSuffix() const
void setInitiallySelectedNameFilter(const QString &)
QList< QUrl > sidebarUrls() const
bool useDefaultNameFilters() const
QUrl initialDirectory() const
@ DontUseCustomDirectoryIcons
QStringList nameFilters() const
ViewMode viewMode() const
FileDialogOptions options() const
QStringList history() const
FileMode fileMode() const
void setSidebarUrls(const QList< QUrl > &urls)
static QString defaultNameFilterString()
void setInitiallySelectedFiles(const QList< QUrl > &)
QModelIndex select(const QModelIndex &index) const
QModelIndex mapFromSource(const QModelIndex &index) const
void emitFilesSelected(const QStringList &files)
void _q_nativeEnterDirectory(const QUrl &directory)
static void setLastVisitedDirectory(const QUrl &dir)
void navigate(HistoryItem &)
QList< QPersistentModelIndex > PersistentModelIndexList
void _q_currentChanged(const QModelIndex &index)
void _q_navigateToParent()
void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text)
QString getEnvironmentVariable(const QString &string)
void _q_fileRenamed(const QString &path, const QString &oldName, const QString &newName)
static long maxNameLength(const QString &path)
bool removeDirectory(const QString &path)
QAbstractItemView * currentView() const
QScopedPointer< Ui_QFileDialog > qFileDialogUi
void updateFileTypeLabel()
void _q_rowsInserted(const QModelIndex &parent)
void _q_useNameFilter(int index)
void _q_emitUrlsSelected(const QList< QUrl > &files)
void retranslateStrings()
QAction * showHiddenAction
void _q_enterDirectory(const QModelIndex &index)
void retranslateWindowTitle()
void _q_pathChanged(const QString &)
QList< QUrl > sidebarUrls
static QString toInternal(const QString &path)
void _q_createDirectory()
void _q_emitUrlSelected(const QUrl &file)
QLineEdit * lineEdit() const
void updateCancelButtonText()
QStringList typedFiles() const
QList< QUrl > selectedFiles_sys() const
QFileIconProvider defaultIconProvider
QAction * newFolderAction
QList< HistoryItem > currentHistory
void _q_navigateForward()
virtual void helperPrepareShow(QPlatformDialogHelper *) override
void setRootIndex(const QModelIndex &index) const
void _q_navigateBackward()
QList< QUrl > userSelectedFiles() const
QList< QUrl > addDefaultSuffixToUrls(const QList< QUrl > &urlsToFix) const
bool restoreWidgetState(QStringList &history, int splitterPosition)
QModelIndex rootIndex() const
QModelIndex mapToSource(const QModelIndex &index) const
int currentHistoryLocation
void updateFileNameLabel()
void _q_showContextMenu(const QPoint &position)
void _q_selectionChanged()
bool canBeNativeDialog() const override
void updateOkButtonText(bool saveAsOnFolder=false)
QPlatformFileDialogHelper * platformFileDialogHelper() const
void _q_showHeader(QAction *)
bool itemViewKeyboardEvent(QKeyEvent *event)
void init(const QFileDialogArgs &args)
virtual void initHelper(QPlatformDialogHelper *) override
void _q_autoCompleteFileName(const QString &)
void _q_showDetailsView()
virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) override
void _q_goToDirectory(const QString &)
QSharedPointer< QFileDialogOptions > options
void _q_nativeCurrentChanged(const QUrl &file)
void _q_goToUrl(const QUrl &url)
void saveHistorySelection()
QStringList addDefaultSuffixToFiles(const QStringList &filesToFix) const
bool usingWidgets() const
void keyPressEvent(QKeyEvent *e) override
QSize sizeHint() const override
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
The QFileDialog class provides a dialog that allow users to select files or directories.
QList< QUrl > sidebarUrls() const
Options options
the various options that affect the look and feel of the dialog
void setFilter(QDir::Filters filters)
FileMode
This enum is used to indicate what the user may select in the file dialog; i.e.
static QString getExistingDirectory(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), Options options=ShowDirsOnly)
This is a convenience static function that will return an existing directory selected by the user.
static QList< QUrl > getOpenFileUrls(QWidget *parent=nullptr, const QString &caption=QString(), const QUrl &dir=QUrl(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options(), const QStringList &supportedSchemes=QStringList())
This is a convenience static function that will return one or more existing files selected by the use...
bool restoreState(const QByteArray &state)
~QFileDialog()
Destroys the file dialog.
void currentChanged(const QString &path)
When the current file changes for local operations, this signal is emitted with the new file name as ...
QString selectedNameFilter() const
void selectFile(const QString &filename)
Selects the given filename in the file dialog.
QFileDialog(QWidget *parent, Qt::WindowFlags f)
bool testOption(Option option) const
QStringList nameFilters() const
static QString getSaveFileName(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
This is a convenience static function that will return a file name selected by the user.
void setDefaultSuffix(const QString &suffix)
void filesSelected(const QStringList &files)
When the selection changes for local operations and the dialog is accepted, this signal is emitted wi...
void setSupportedSchemes(const QStringList &schemes)
static QUrl getExistingDirectoryUrl(QWidget *parent=nullptr, const QString &caption=QString(), const QUrl &dir=QUrl(), Options options=ShowDirsOnly, const QStringList &supportedSchemes=QStringList())
This is a convenience static function that will return an existing directory selected by the user.
void setNameFilters(const QStringList &filters)
static QString getOpenFileName(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
This is a convenience static function that returns an existing file selected by the user.
AcceptMode acceptMode
the accept mode of the dialog
QUrl directoryUrl() const
Returns the url of the directory currently being displayed in the dialog.
void fileSelected(const QString &file)
When the selection changes for local operations and the dialog is accepted, this signal is emitted wi...
void setViewMode(ViewMode mode)
FileMode fileMode
the file mode of the dialog
QStringList selectedFiles() const
Returns a list of strings containing the absolute paths of the selected files in the dialog.
void setAcceptMode(AcceptMode mode)
void selectNameFilter(const QString &filter)
QStringList supportedSchemes
the URL schemes that the file dialog should allow navigating to.
void setHistory(const QStringList &paths)
Sets the browsing history of the filedialog to contain the given paths.
@ DontUseCustomDirectoryIcons
QDir directory() const
Returns the directory currently being displayed in the dialog.
ViewMode viewMode
the way files and directories are displayed in the dialog
void setDirectory(const QString &directory)
Sets the file dialog's current directory.
static QUrl getOpenFileUrl(QWidget *parent=nullptr, const QString &caption=QString(), const QUrl &dir=QUrl(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options(), const QStringList &supportedSchemes=QStringList())
This is a convenience static function that returns an existing file selected by the user.
void selectUrl(const QUrl &url)
Selects the given url in the file dialog.
static void getOpenFileContent(const QString &nameFilter, const std::function< void(const QString &, const QByteArray &)> &fileContentsReady)
This is a convenience static function that will return the content of a file selected by the user.
void setFileMode(FileMode mode)
void setNameFilter(const QString &filter)
DialogLabel
\value LookIn \value FileName \value FileType \value Accept \value Reject
QByteArray saveState() const
QStringList history() const
Returns the browsing history of the filedialog as a list of paths.
AcceptMode
\value AcceptOpen \value AcceptSave
void setLabelText(DialogLabel label, const QString &text)
Sets the text shown in the filedialog in the specified label.
void accept() override
\reimp
static QUrl getSaveFileUrl(QWidget *parent=nullptr, const QString &caption=QString(), const QUrl &dir=QUrl(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options(), const QStringList &supportedSchemes=QStringList())
This is a convenience static function that returns a file selected by the user.
void setSidebarUrls(const QList< QUrl > &urls)
static void saveFileContent(const QByteArray &fileContent, const QString &fileNameHint=QString())
This is a convenience static function that saves fileContent to a file, using a file name and locatio...
QAbstractItemDelegate * itemDelegate() const
Returns the item delegate used to render the items in the views in the filedialog.
void changeEvent(QEvent *e) override
\reimp
static QStringList getOpenFileNames(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
This is a convenience static function that will return one or more existing files selected by the use...
QList< QUrl > selectedUrls() const
Returns a list of urls containing the selected files in the dialog.
QString selectedMimeTypeFilter() const
QString defaultSuffix
suffix added to the filename if no other suffix was specified
void setItemDelegate(QAbstractItemDelegate *delegate)
Sets the item delegate used to render items in the views in the file dialog to the given delegate.
QString labelText(DialogLabel label) const
Returns the text shown in the filedialog in the specified label.
void setDirectoryUrl(const QUrl &directory)
Sets the file dialog's current directory url.
void setOption(Option option, bool on=true)
void setOptions(Options options)
QAbstractFileIconProvider * iconProvider() const
Returns the icon provider used by the filedialog.
ViewMode
This enum describes the view mode of the file dialog; i.e.
void setIconProvider(QAbstractFileIconProvider *provider)
Sets the icon provider used by the filedialog to the specified provider.
QDir::Filters filter() const
\inmodule QtCore \reentrant
bool isSymLink() const
Returns true if this object points to a symbolic link, shortcut, or alias; otherwise returns false.
QString suffix() const
Returns the suffix (extension) of the file.
QString fileName() const
Returns the name of the file, excluding the path.
QString absoluteFilePath() const
Returns an absolute path including the file name.
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory.
QString absolutePath() const
Returns a file's path absolute path.
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
QDir absoluteDir() const
Returns the file's absolute path as a QDir object.
bool isAbsolute() const
Returns true if the file path is absolute, otherwise returns false (i.e.
QString path() const
Returns the file's path.
bool exists() const
Returns true if the file exists; otherwise returns false.
The QFileSystemModel class provides a data model for the local filesystem.
QModelIndex mkdir(const QModelIndex &parent, const QString &name)
Create a directory with the name in the parent model index.
QDir rootDirectory() const
The currently set directory.
void setNameFilterDisables(bool enable)
QString rootPath() const
The currently set root path.
QFileInfo fileInfo(const QModelIndex &index) const
Returns the QFileInfo for the item stored in the model under the given index.
void setIconProvider(QAbstractFileIconProvider *provider)
Sets the provider of file icons for the directory model.
QVariant myComputer(int role=Qt::DisplayRole) const
Returns the data stored under the given role for the item "My Computer".
void fetchMore(const QModelIndex &parent) override
\reimp
void setReadOnly(bool enable)
void setNameFilters(const QStringList &filters)
Sets the name filters to apply against the existing files.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
\reimp
void setFilter(QDir::Filters filters)
Sets the directory model's filter to that specified by filters.
bool remove(const QModelIndex &index)
Removes the model item index from the file system model and {deletes the corresponding file from the ...
bool isDir(const QModelIndex &index) const
Returns true if the model item index represents a directory; otherwise returns false.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
static QByteArray encodeName(const QString &fileName)
Converts fileName to an 8-bit encoding that you can use in native APIs.
static QString decodeName(const QByteArray &localFileName)
This does the reverse of QFile::encodeName() using localFileName.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
\reentrant \inmodule QtGui
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
int horizontalAdvance(const QString &, int len=-1) const
Returns the horizontal advance in pixels of the first len characters of text.
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
The QKeyEvent class describes a key event.
The QLineEdit widget is a one-line text editor.
void selectAll()
Selects all the text (i.e.
void clear()
Clears the contents of the line edit.
void setText(const QString &)
QString text
the line edit's text.
void keyPressEvent(QKeyEvent *) override
Converts the given key press event into a line edit action.
void setWrapping(bool enable)
void setResizeMode(ResizeMode mode)
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
const_reverse_iterator crbegin() const noexcept
qsizetype removeAll(const AT &t)
void prepend(rvalue_ref t)
const T & constFirst() const noexcept
void reserve(qsizetype size)
const_iterator cend() const noexcept
void append(parameter_type t)
const_iterator cbegin() const noexcept
const_reverse_iterator crend() const noexcept
The QMessageBox class provides a modal dialog for informing the user or for asking the user a questio...
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
QMimeType mimeTypeForName(const QString &nameOrAlias) const
Returns a MIME type for nameOrAlias or an invalid one if none found.
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
constexpr int row() const noexcept
Returns the row this model index refers to.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
constexpr const QAbstractItemModel * model() const noexcept
Returns a pointer to the model containing the item that this index refers to.
constexpr int column() const noexcept
Returns the column this model index refers to.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void setParent(QObject *parent)
Makes the object a child of parent.
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
The QPaintEvent class contains event parameters for paint events.
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int width() const noexcept
Returns the width of the rectangle.
\inmodule QtCore \reentrant
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
void setValue(QAnyStringView key, const QVariant &value)
Sets the value of setting key to value.
QVariant value(QAnyStringView key, const QVariant &defaultValue) const
Returns the value for setting key.
QStringList childGroups() const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
void beginGroup(QAnyStringView prefix)
Appends prefix to the current group.
The QShortcut class is used to create keyboard shortcuts.
Exception-safe wrapper around QObject::blockSignals().
constexpr int width() const noexcept
Returns the width.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
The QStandardItemModel class provides a generic model for storing custom data.
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
Returns the substring of length length starting at position start in this object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray toLatin1() const &
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
static QString fromStdString(const std::string &s)
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void clear()
Clears the contents of the string and makes it null.
bool isNull() const
Returns true if this string is null; otherwise returns false.
qsizetype size() const
Returns the number of characters in this string.
std::string toStdString() const
Returns a std::string object with the data contained in this QString.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
QString simplified() const &
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QChar * data()
Returns a pointer to the data stored in the QString.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString sliced(qsizetype pos) const
QString & append(QChar c)
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
\variable QStyleOptionToolButton::features
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=nullptr) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
@ SH_ItemView_ActivateItemOnSingleClick
@ SP_FileDialogDetailedView
void setItemsExpandable(bool enable)
QHeaderView * header() const
Returns the header for the tree view.
void keyPressEvent(QKeyEvent *event) override
\reimp
void setRootIsDecorated(bool show)
void setSortingEnabled(bool enable)
void setUrls(const QList< QUrl > &list)
void addUrls(const QList< QUrl > &urls, int row=-1, bool move=true)
Add urls list into the list at row.
void setFileSystemModel(QFileSystemModel *model)
QFileSystemModel to get index's from, clears existing rows.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
static QList< QUrl > fromStringList(const QStringList &uris, ParsingMode mode=TolerantMode)
QString fileName(ComponentFormattingOptions options=FullyDecoded) const
static QStringList toStringList(const QList< QUrl > &uris, FormattingOptions options=FormattingOptions(PrettyDecoded))
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
QStringList toStringList() const
Returns the variant as a QStringList if the variant has userType() \l QMetaType::QStringList,...
QUrl toUrl() const
Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an ...
void textChanged(const QString &newText)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
void saveFile(const QByteArray &data, const std::string &fileNameHint)
void openFile(const std::string &accept, const std::function< void(bool fileSelected)> &fileDialogClosed, const std::function< char *(uint64_t size, const std::string &name)> &acceptFile, const std::function< void()> &fileDataReady)
@ NavigationModeKeypadDirectional
@ WA_WState_ExplicitShowHide
@ AA_DontUseNativeDialogs
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
static QUrl _qt_get_directory(const QUrl &url, const QFileInfo &local)
static const qint32 QFileDialogMagic
QStringList qt_strip_filters(const QStringList &filters)
QStringList qt_make_filter_list(const QString &filter)
static QString fileFromPath(const QString &rootPath, QString path)
static bool isCaseSensitiveFileSystem(const QString &path)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLuint * paths
GLuint GLsizei const GLchar * label
[43]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLuint GLsizei const GLchar * message
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLsizei const GLchar *const * string
[0]
static QT_BEGIN_NAMESPACE bool isRelative(const QString &path)
static QString absolutePath(const QString &path)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static constexpr QChar sep
#define QStringLiteral(str)
#define QT_BEGIN_INCLUDE_NAMESPACE
#define Q_AUTOTEST_EXPORT
#define QT_END_INCLUDE_NAMESPACE
#define QT_CONFIG(feature)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
const char className[16]
[1]
QSqlQueryModel * model
[16]
if(qFloatDistance(a, b)<(1<< 7))
[0]
QFileInfo info(fileName)
[8]
QSettings settings("MySoft", "Star Runner")
[0]
QUrl url("example.com")
[constructor-url-reference]
application x qt windows mime
[2]
myObject disconnect()
[26]
XML files xml auto fileContentReady
[14]
QFileDialog dialog(this)
[1]
dialog setFileMode(QFileDialog::AnyFile)
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]
QCompleter * completer
[0]
char * toString(const MyType &t)
[31]
QFileDialogArgs(const QUrl &url={})
PersistentModelIndexList selection
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent