Warning, file /include/QtWidgets/qcompleter.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QCOMPLETER_H
0005 #define QCOMPLETER_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qobject.h>
0009 #include <QtCore/qpoint.h>
0010 #include <QtCore/qstring.h>
0011 #include <QtCore/qabstractitemmodel.h>
0012 #include <QtCore/qrect.h>
0013
0014 QT_REQUIRE_CONFIG(completer);
0015
0016 QT_BEGIN_NAMESPACE
0017
0018 class QCompleterPrivate;
0019 class QAbstractItemView;
0020 class QAbstractProxyModel;
0021 class QWidget;
0022
0023 class Q_WIDGETS_EXPORT QCompleter : public QObject
0024 {
0025 Q_OBJECT
0026 Q_PROPERTY(QString completionPrefix READ completionPrefix WRITE setCompletionPrefix)
0027 Q_PROPERTY(ModelSorting modelSorting READ modelSorting WRITE setModelSorting)
0028 Q_PROPERTY(Qt::MatchFlags filterMode READ filterMode WRITE setFilterMode)
0029 Q_PROPERTY(CompletionMode completionMode READ completionMode WRITE setCompletionMode)
0030 Q_PROPERTY(int completionColumn READ completionColumn WRITE setCompletionColumn)
0031 Q_PROPERTY(int completionRole READ completionRole WRITE setCompletionRole)
0032 Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems)
0033 Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity)
0034 Q_PROPERTY(bool wrapAround READ wrapAround WRITE setWrapAround)
0035
0036 public:
0037 enum CompletionMode {
0038 PopupCompletion,
0039 UnfilteredPopupCompletion,
0040 InlineCompletion
0041 };
0042 Q_ENUM(CompletionMode)
0043
0044 enum ModelSorting {
0045 UnsortedModel = 0,
0046 CaseSensitivelySortedModel,
0047 CaseInsensitivelySortedModel
0048 };
0049 Q_ENUM(ModelSorting)
0050
0051 QCompleter(QObject *parent = nullptr);
0052 QCompleter(QAbstractItemModel *model, QObject *parent = nullptr);
0053 #if QT_CONFIG(stringlistmodel)
0054 QCompleter(const QStringList& completions, QObject *parent = nullptr);
0055 #endif
0056 ~QCompleter() override;
0057
0058 void setWidget(QWidget *widget);
0059 QWidget *widget() const;
0060
0061 void setModel(QAbstractItemModel *c);
0062 QAbstractItemModel *model() const;
0063
0064 void setCompletionMode(CompletionMode mode);
0065 CompletionMode completionMode() const;
0066
0067 void setFilterMode(Qt::MatchFlags filterMode);
0068 Qt::MatchFlags filterMode() const;
0069
0070 QAbstractItemView *popup() const;
0071 void setPopup(QAbstractItemView *popup);
0072
0073 void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity);
0074 Qt::CaseSensitivity caseSensitivity() const;
0075
0076 void setModelSorting(ModelSorting sorting);
0077 ModelSorting modelSorting() const;
0078
0079 void setCompletionColumn(int column);
0080 int completionColumn() const;
0081
0082 void setCompletionRole(int role);
0083 int completionRole() const;
0084
0085 bool wrapAround() const;
0086
0087 int maxVisibleItems() const;
0088 void setMaxVisibleItems(int maxItems);
0089
0090 int completionCount() const;
0091 bool setCurrentRow(int row);
0092 int currentRow() const;
0093
0094 QModelIndex currentIndex() const;
0095 QString currentCompletion() const;
0096
0097 QAbstractItemModel *completionModel() const;
0098
0099 QString completionPrefix() const;
0100
0101 public Q_SLOTS:
0102 void setCompletionPrefix(const QString &prefix);
0103 void complete(const QRect& rect = QRect());
0104 void setWrapAround(bool wrap);
0105
0106 public:
0107 virtual QString pathFromIndex(const QModelIndex &index) const;
0108 virtual QStringList splitPath(const QString &path) const;
0109
0110 protected:
0111 bool eventFilter(QObject *o, QEvent *e) override;
0112 bool event(QEvent *) override;
0113
0114 Q_SIGNALS:
0115 void activated(const QString &text);
0116 void activated(const QModelIndex &index);
0117 void highlighted(const QString &text);
0118 void highlighted(const QModelIndex &index);
0119
0120 private:
0121 Q_DISABLE_COPY(QCompleter)
0122 Q_DECLARE_PRIVATE(QCompleter)
0123
0124 Q_PRIVATE_SLOT(d_func(), void _q_complete(QModelIndex))
0125 Q_PRIVATE_SLOT(d_func(), void _q_completionSelected(const QItemSelection&))
0126 Q_PRIVATE_SLOT(d_func(), void _q_autoResizePopup())
0127 Q_PRIVATE_SLOT(d_func(), void _q_fileSystemModelDirectoryLoaded(const QString&))
0128 };
0129
0130 QT_END_NAMESPACE
0131
0132 #endif