| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QFSCOMPLETOR_P_H |
| 5 | #define QFSCOMPLETOR_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtWidgets/private/qtwidgetsglobal_p.h> |
| 19 | #include "qcompleter.h" |
| 20 | #include <QtGui/qfilesystemmodel.h> |
| 21 | |
| 22 | QT_REQUIRE_CONFIG(fscompleter); |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | /*! |
| 27 | QCompleter that can deal with QFileSystemModel |
| 28 | */ |
| 29 | class Q_WIDGETS_EXPORT QFSCompleter : public QCompleter { |
| 30 | public: |
| 31 | explicit QFSCompleter(QFileSystemModel *model, QObject *parent = nullptr) |
| 32 | : QCompleter(model, parent), proxyModel(nullptr), sourceModel(model) |
| 33 | { |
| 34 | #if defined(Q_OS_WIN) |
| 35 | setCaseSensitivity(Qt::CaseInsensitive); |
| 36 | #endif |
| 37 | } |
| 38 | QString pathFromIndex(const QModelIndex &index) const override; |
| 39 | QStringList splitPath(const QString& path) const override; |
| 40 | |
| 41 | QAbstractProxyModel *proxyModel; |
| 42 | QFileSystemModel *sourceModel; |
| 43 | }; |
| 44 | |
| 45 | QT_END_NAMESPACE |
| 46 | |
| 47 | #endif // QFSCOMPLETOR_P_H |
| 48 | |
| 49 | |