itom
Loading...
Searching...
No Matches
completer.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26
27 This file is a port and modified version of the
28 Common framework (http://www.commontk.org)
29*********************************************************************** */
30
31#ifndef COMPLETER_H
32#define COMPLETER_H
33
34// Qt includes
35#include <QCompleter>
36#include <QMetaType>
37
38#include "commonWidgets.h"
39
40// CTK includes
42
63class ITOMWIDGETS_EXPORT Completer: public QCompleter
64{
65 Q_OBJECT
66 Q_ENUMS(ModelFiltering)
74 Q_PROPERTY(ModelFiltering modelFiltering READ modelFiltering WRITE setModelFiltering)
75
76public:
77 Completer(QObject* parent = 0);
78 Completer(QAbstractItemModel* model, QObject* parent = 0);
79 Completer(const QStringList& list, QObject* parent = 0 );
80 virtual ~Completer();
81
82 enum ModelFiltering
83 {
84 FilterStartsWith=0,
85 FilterContains,
86 FilterWordStartsWith
87 };
88
89 ModelFiltering modelFiltering()const;
90 void setModelFiltering(ModelFiltering filter);
91
92 virtual QStringList splitPath(const QString& s)const;
93
98 QAbstractItemModel* sourceModel()const;
99 void setSourceModel(QAbstractItemModel* model);
100
101protected:
102 QScopedPointer<CompleterPrivate> d_ptr;
103
104private:
105 Q_DECLARE_PRIVATE(Completer);
106 Q_DISABLE_COPY(Completer);
107};
108
109Q_DECLARE_METATYPE(Completer::ModelFiltering)
110
111#endif // __Completer_h
Definition completer.h:64
Definition completer.cpp:41