QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsfieldvalueslineedit.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfieldvalueslineedit.h
3
-----------------------
4
Date : 20-08-2016
5
Copyright : (C) 2016 by Nyall Dawson
6
Email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef QGSFIELDVALUESLINEEDIT_H
16
#define QGSFIELDVALUESLINEEDIT_H
17
18
#include "qgis_gui.h"
19
#include "
qgis_sip.h
"
20
#include "
qgsfeedback.h
"
21
#include "
qgsfilterlineedit.h
"
22
23
#include <QFocusEvent>
24
#include <QHeaderView>
25
#include <QMutex>
26
#include <QStringListModel>
27
#include <QThread>
28
#include <QTimer>
29
#include <QTreeView>
30
31
class
QgsFloatingWidget
;
32
class
QgsVectorLayer
;
33
34
35
#ifndef SIP_RUN
36
37
// just internal guff - definitely not for exposing to public API!
39
44
class
QgsFieldValuesLineEditValuesGatherer :
public
QThread
45
{
46
Q_OBJECT
47
48
public
:
49
QgsFieldValuesLineEditValuesGatherer( QgsVectorLayer *layer,
int
attributeIndex )
50
: mLayer( layer )
51
, mAttributeIndex( attributeIndex )
52
{}
53
57
void
setSubstring(
const
QString &
string
) { mSubstring = string; }
58
59
void
run()
override
;
60
62
void
stop();
63
65
bool
wasCanceled()
const
{
return
mWasCanceled; }
66
67
signals:
68
73
void
collectedValues(
const
QStringList &values );
74
75
private
:
76
QgsVectorLayer *mLayer =
nullptr
;
77
int
mAttributeIndex;
78
QString mSubstring;
79
QStringList mValues;
80
QgsFeedback *mFeedback =
nullptr
;
81
QMutex mFeedbackMutex;
82
bool
mWasCanceled =
false
;
83
};
84
86
87
#endif
88
97
class
GUI_EXPORT
QgsFieldValuesLineEdit
:
public
QgsFilterLineEdit
98
{
99
Q_OBJECT
100
101
Q_PROPERTY(
QgsVectorLayer
*
layer
READ
layer
WRITE
setLayer
NOTIFY
layerChanged
)
102
Q_PROPERTY(
int
attributeIndex
READ
attributeIndex
WRITE
setAttributeIndex
NOTIFY
attributeIndexChanged
)
103
104
public:
109
QgsFieldValuesLineEdit
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
110
111
~
QgsFieldValuesLineEdit
() override;
112
119
void
setLayer
(
QgsVectorLayer
*
layer
);
120
126
QgsVectorLayer
*
layer
()
const
{
return
mLayer; }
127
134
void
setAttributeIndex(
int
index );
135
141
int
attributeIndex
()
const
{
return
mAttributeIndex; }
142
143
signals:
144
149
void
layerChanged
(
QgsVectorLayer
*
layer
);
150
155
void
attributeIndexChanged
(
int
index );
156
157
private
slots:
158
163
void
requestCompleterUpdate();
164
169
void
triggerCompleterUpdate();
170
175
void
updateCompleter(
const
QStringList &values );
176
182
void
gathererThreadFinished();
183
184
private
:
185
QgsVectorLayer
*mLayer =
nullptr
;
186
int
mAttributeIndex = -1;
187
189
bool
mUpdateRequested =
false
;
190
192
QTimer mShowPopupTimer;
193
195
QgsFieldValuesLineEditValuesGatherer *mGatherer =
nullptr
;
196
198
QString mRequestedCompletionText;
199
201
void
updateCompletionList(
const
QString &substring );
202
};
203
204
205
#endif
//QGSFIELDVALUESLINEEDIT_H
QgsFieldValuesLineEdit::layer
QgsVectorLayer * layer
Definition
qgsfieldvalueslineedit.h:101
QgsFieldValuesLineEdit::attributeIndexChanged
void attributeIndexChanged(int index)
Emitted when the field associated with the widget changes.
QgsFieldValuesLineEdit::QgsFieldValuesLineEdit
QgsFieldValuesLineEdit(QWidget *parent=nullptr)
Constructor for QgsFieldValuesLineEdit.
Definition
qgsfieldvalueslineedit.cpp:28
QgsFieldValuesLineEdit::setLayer
void setLayer(QgsVectorLayer *layer)
Sets the layer containing the field that values will be shown from.
Definition
qgsfieldvalueslineedit.cpp:51
QgsFieldValuesLineEdit::layerChanged
void layerChanged(QgsVectorLayer *layer)
Emitted when the layer associated with the widget changes.
QgsFieldValuesLineEdit::setAttributeIndex
void setAttributeIndex(int index)
Sets the attribute index for the field containing values to show in the widget.
Definition
qgsfieldvalueslineedit.cpp:60
QgsFieldValuesLineEdit::attributeIndex
int attributeIndex() const
Returns the attribute index for the field containing values shown in the widget.
Definition
qgsfieldvalueslineedit.h:141
QgsFieldValuesLineEdit::attributeIndex
int attributeIndex
Definition
qgsfieldvalueslineedit.h:102
QgsFilterLineEdit::QgsFilterLineEdit
QgsFilterLineEdit(QWidget *parent=nullptr, const QString &nullValue=QString())
Constructor for QgsFilterLineEdit.
Definition
qgsfilterlineedit.cpp:35
QgsFloatingWidget
A QWidget subclass for creating widgets which float outside of the normal Qt layout system.
Definition
qgsfloatingwidget.h:37
QgsVectorLayer
Represents a vector layer which manages a vector based dataset.
Definition
qgsvectorlayer.h:414
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
qgsfeedback.h
qgsfilterlineedit.h
Generated on
for QGIS API Documentation by
1.17.0