6#include <QtCore/qlist.h>
7#include <QtCore/qloggingcategory.h>
8#include <QtQml/qqmlfile.h>
9#include <QtQml/qqmlinfo.h>
11#include <QtQuickDialogs2Utils/private/qquickfilenamefilter_p.h>
85 qCDebug(lcFileDialog) <<
"setFileMode called with" <<
mode;
86 if (
mode == m_fileMode)
129 return addDefaultSuffix(m_selectedFiles.
value(0));
150 return addDefaultSuffixes(m_selectedFiles);
153void QQuickFileDialog::setSelectedFiles(
const QList<QUrl> &selectedFiles)
160 qmlWarning(
this) <<
"Cannot set more than one selected file when fileMode is SaveFile";
168 qmlWarning(
this) <<
"Cannot set " << selectedFilePath
169 <<
" as a selected file because it doesn't exist";
176 const bool firstChanged = m_selectedFiles.
value(0) != newFirstSelectedFile;
234 return fileDialog->directory();
321 qCDebug(lcFileDialog).nospace() <<
"setNameFilters called with " <<
filters
322 <<
" (old filters were: " << m_options->
nameFilters() <<
")";
327 if (m_selectedNameFilter) {
329 if (index < 0 || index >=
filters.size())
395 if (!m_selectedNameFilter) {
400 return m_selectedNameFilter;
500 qCDebug(lcDialogs) <<
" - the FileDialog was told not to use a native dialog; not using native dialog";
511 this, [
this, fileDialog](){ setSelectedFiles(fileDialog->selectedFiles()); });
513 fileDialog->setOptions(m_options);
537 fileDialog->setOptions(m_options);
540 fileDialog->selectNameFilter(
filter);
561 if (m_selectedNameFilter)
566QUrl QQuickFileDialog::addDefaultSuffix(
const QUrl &
file)
const
573 const bool isContentScheme =
url.
scheme() == u
"content"_s;
585 setSelectedFiles(fileDialog->selectedFiles());
595 urls += addDefaultSuffix(
file);
601#include "moc_qquickfiledialog_p.cpp"
static QString currentPath()
Returns the absolute path of the application's current directory.
QList< QUrl > initiallySelectedFiles() const
void setWindowTitle(const QString &)
QString labelText(DialogLabel label) const
void setNameFilters(const QStringList &filters)
void setOptions(FileDialogOptions options)
QString defaultSuffix() const
void setInitiallySelectedNameFilter(const QString &)
QUrl initialDirectory() const
QStringList nameFilters() const
FileDialogOptions options() const
void setLabelText(DialogLabel label, const QString &text)
void setFileMode(FileMode mode)
void setAcceptMode(AcceptMode mode)
void setInitialDirectory(const QUrl &)
bool testOption(FileDialogOption option) const
void setDefaultSuffix(const QString &suffix)
void setInitiallySelectedFiles(const QList< QUrl > &)
bool exists() const
Returns true if the file exists; otherwise returns false.
qsizetype size() const noexcept
bool isEmpty() const noexcept
T value(qsizetype i) const
void reserve(qsizetype size)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to QFile.
QPlatformDialogHelper * handle() const
virtual void accept()
\qmlmethod void QtQuick.Dialogs::Dialog::accept()
virtual bool useNativeDialog() const
virtual void onShow(QPlatformDialogHelper *dialog)
void defaultSuffixChanged()
QFileDialogOptions::FileDialogOptions options
void onHide(QPlatformDialogHelper *dialog) override
void onShow(QPlatformDialogHelper *dialog) override
void accept() override
\qmlmethod void QtQuick.Dialogs::Dialog::accept()
void currentFolderChanged()
void setRejectLabel(const QString &label)
void onCreate(QPlatformDialogHelper *dialog) override
void setOptions(QFileDialogOptions::FileDialogOptions options)
void resetDefaultSuffix()
void setDefaultSuffix(const QString &suffix)
bool useNativeDialog() const override
void selectedFilesChanged()
void setCurrentFolder(const QUrl ¤tFolder)
void rejectLabelChanged()
void setAcceptLabel(const QString &label)
void nameFiltersChanged()
void setCurrentFile(const QUrl &file)
void setNameFilters(const QStringList &filters)
void setSelectedFile(const QUrl &selectedFile)
void setCurrentFiles(const QList< QUrl > ¤tFiles)
void currentFileChanged()
void acceptLabelChanged()
void currentFilesChanged()
void selectedFileChanged()
void setFileMode(FileMode fileMode)
QList< QUrl > selectedFiles
QList< QUrl > currentFiles
QQuickFileNameFilter * selectedNameFilter
void setOptions(const QSharedPointer< QFileDialogOptions > &options)
void update(const QString &filter)
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
QString scheme() const
Returns the scheme of the URL.
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
Combined button and popup list for selecting options.
SharedPointerFileDialogOptions m_options
QStringList * m_selectedNameFilter
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLuint GLsizei const GLchar * label
[43]
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLsizei const GLchar *const * path
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QUrl url("example.com")
[constructor-url-reference]
myObject disconnect()
[26]
QFileDialog dialog(this)
[1]
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]
\inmodule QtCore \reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent