QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsdefaultsearchwidgetwrapper.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgstexteditwrapper.cpp
3  --------------------------------------
4  Date : 5.1.2014
5  Copyright : (C) 2014 Matthias Kuhn
6  Email : matthias dot kuhn at gmx dot ch
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 
17 
18 #include "qgsfield.h"
19 #include "qgsfieldvalidator.h"
20 
21 #include <QSettings>
22 #include <QSizePolicy>
23 
25  : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent )
26  , mLineEdit( NULL )
27 {
28 }
29 
31 {
32  return mLineEdit->text();
33 }
34 
36 {
37  return new QgsFilterLineEdit( parent );
38 }
39 
41 {
42  mLineEdit = qobject_cast<QgsFilterLineEdit*>( widget );
43  mLineEdit->setSizePolicy( QSizePolicy ::Expanding , QSizePolicy ::Fixed );
44  connect( widget, SIGNAL( textChanged( QString ) ), this, SLOT( valueChanged( QString ) ) );
45 }
46 
48 {
49  mLineEdit->setText( value.toString() ); //FIXME no null check :(
50 }
51 
53 {
54  mLineEdit->setReadOnly( !enabled );
55 #if 0
56  if ( enabled )
57  mLineEdit->setPalette( mWritablePalette );
58  else
59  mLineEdit->setPalette( mReadOnlyPalette );
60 #endif
61 }
void setPalette(const QPalette &)
void valueChanged()
Will call the value() method to determine the emitted value.
Manages an editor widget Widget and wrapper share the same parent.
QWidget * createWidget(QWidget *parent) override
This method should create a new widget with the provided parent.
void initWidget(QWidget *editor) override
This method should initialize the editor widget with runtime data.
QgsDefaultSearchWidgetWrapper(QgsVectorLayer *vl, int fieldIdx, QWidget *editor=0, QWidget *parent=0)
void setReadOnly(bool)
Lineedit with builtin clear button.
void setSizePolicy(QSizePolicy)
void setValue(const QVariant &value) override
QWidget * widget()
Access the widget managed by this wrapper.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
QString toString() const
QVariant value() override
Will be used to access the widget's value.