-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2059 from carolinux/search-widgets
[FEATURE] Search widgets Makes it easier to filter the attribute table if there are attribute domains attached
- Loading branch information
Showing
12 changed files
with
224 additions
and
13 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
59 changes: 59 additions & 0 deletions
59
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,59 @@ | ||
/*************************************************************************** | ||
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> | ||
#include <QSizePolicy> | ||
|
||
QgsDefaultSearchWidgetWrapper::QgsDefaultSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) | ||
: QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) | ||
, mLineEdit( NULL ) | ||
{ | ||
} | ||
|
||
QVariant QgsDefaultSearchWidgetWrapper::value() | ||
{ | ||
return mLineEdit->text(); | ||
} | ||
|
||
QWidget* QgsDefaultSearchWidgetWrapper::createWidget( QWidget* parent ) | ||
{ | ||
return new QgsFilterLineEdit( parent ); | ||
} | ||
|
||
void QgsDefaultSearchWidgetWrapper::initWidget( QWidget* widget ) | ||
{ | ||
mLineEdit = qobject_cast<QgsFilterLineEdit*>( widget ); | ||
mLineEdit->setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Fixed ); | ||
connect( widget, 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 @@ | ||
/*************************************************************************** | ||
qgsdefaultsearchwidgetwrapper.h | ||
-------------------------------------- | ||
Date : 21.5.2015 | ||
Copyright : (C) 2015 Karolina Alexiou | ||
Email : carolinegr at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* 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
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
Oops, something went wrong.