Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
153 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/gui/editorwidgets/core/qgsdefaultsearchwidgetwrapper.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*************************************************************************** | ||
qgstexteditwrapper.cpp | ||
-------------------------------------- | ||
Date : 5.1.2014 | ||
Copyright : (C) 2014 Matthias Kuhn | ||
Email : matthias dot kuhn at gmx dot ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsdefaultsearchwidgetwrapper.h" | ||
|
||
#include "qgsfield.h" | ||
#include "qgsfieldvalidator.h" | ||
|
||
#include <QSettings> | ||
|
||
QgsDefaultSearchWidgetWrapper::QgsDefaultSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) | ||
: QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) | ||
, mLineEdit( NULL ) | ||
{ | ||
} | ||
|
||
QVariant QgsDefaultSearchWidgetWrapper::value() | ||
{ | ||
return QString("foo"); | ||
} | ||
|
||
QWidget* QgsDefaultSearchWidgetWrapper::createWidget( QWidget* parent ) | ||
{ | ||
return new QgsFilterLineEdit( parent ); | ||
} | ||
|
||
void QgsDefaultSearchWidgetWrapper::initWidget( QWidget* editor ) | ||
{ | ||
connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( valueChanged( QString ) ) ); | ||
} | ||
|
||
void QgsDefaultSearchWidgetWrapper::setValue( const QVariant& value ) | ||
{ | ||
mLineEdit->setText( value.toString() ); //FIXME no null check :( | ||
} | ||
|
||
void QgsDefaultSearchWidgetWrapper::setEnabled( bool enabled ) | ||
{ | ||
mLineEdit->setReadOnly( !enabled ); | ||
//if ( enabled ) | ||
//mLineEdit->setPalette( mWritablePalette ); | ||
//else | ||
//mLineEdit->setPalette( mReadOnlyPalette ); | ||
} |
50 changes: 50 additions & 0 deletions
50
src/gui/editorwidgets/core/qgsdefaultsearchwidgetwrapper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/*************************************************************************** | ||
qgstexteditwrapper.h | ||
-------------------------------------- | ||
Date : 5.1.2014 | ||
Copyright : (C) 2014 Matthias Kuhn | ||
Email : matthias dot kuhn at gmx dot ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSDEFAULTSEARCHWIDGETWRAPPER_H | ||
#define QGSDEFAULTSEARCHWIDGETWRAPPER_H | ||
|
||
#include "qgseditorwidgetwrapper.h" | ||
#include <qgsfilterlineedit.h> | ||
|
||
|
||
/** | ||
* Wraps a search widget. Default form is just a QgsLineFilterEdit | ||
* | ||
*/ | ||
|
||
class GUI_EXPORT QgsDefaultSearchWidgetWrapper : public QgsEditorWidgetWrapper | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit QgsDefaultSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); | ||
|
||
// QgsEditorWidgetWrapper interface | ||
public: | ||
QVariant value() override; | ||
|
||
protected: | ||
QWidget* createWidget( QWidget* parent ) override; | ||
void initWidget( QWidget* editor ) override; | ||
|
||
public slots: | ||
void setValue( const QVariant& value ) override; | ||
void setEnabled( bool enabled ) override; | ||
|
||
private: | ||
QgsFilterLineEdit* mLineEdit; | ||
}; | ||
|
||
#endif // QGSDEFAULTSEARCHWIDGETWRAPPER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters