Skip to content

Commit

Permalink
[custom widgets] adds filter line edit
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Sep 2, 2014
1 parent a64e7b1 commit f97d5e3
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 63 deletions.
2 changes: 2 additions & 0 deletions python/gui/qgsfilterlineedit.sip
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class QgsFilterLineEdit : QLineEdit
QgsFilterLineEdit( QWidget* parent = 0 );

void setNullValue( QString nullValue );

QString nullValue() const;

signals:
void cleared();
Expand Down
3 changes: 3 additions & 0 deletions src/customwidgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgsdatadefinedbuttonplugin.cpp
qgsfieldcomboboxplugin.cpp
qgsfieldexpressionwidgetplugin.cpp
qgsfilterlineeditplugin.cpp
qgsmaplayercomboboxplugin.cpp
qgsrelationeditorwidgetplugin.cpp
qgsrelationreferencewidgetplugin.cpp
Expand All @@ -37,6 +38,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgsdatadefinedbuttonplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsrelationeditorwidgetplugin.h
qgsrelationreferencewidgetplugin.h
Expand All @@ -60,6 +62,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
qgsdatadefinedbuttonplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsrelationeditorwidgetplugin.h
qgsrelationreferencewidgetplugin.h
Expand Down
63 changes: 0 additions & 63 deletions src/customwidgets/CMakeLists.txt.user

This file was deleted.

100 changes: 100 additions & 0 deletions src/customwidgets/qgsfilterlineeditplugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/***************************************************************************
qgsfilterlineeditplugin.cpp
--------------------------------------
Date : 20.08.2014
Copyright : (C) 2014 Denis Rouzaud
Email : denis.rouzaud@gmail.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. *
* *
***************************************************************************/

#include "qgiscustomwidgets.h"
#include "qgsfilterlineedit.h"
#include "qgsfilterlineeditplugin.h"


QgsFilterLineEditPlugin::QgsFilterLineEditPlugin( QObject *parent )
: QObject( parent )
, mInitialized( false )
{
}


QString QgsFilterLineEditPlugin::name() const
{
return "QgsFilterLineEdit";
}

QString QgsFilterLineEditPlugin::group() const
{
return QgisCustomWidgets::groupName();
}

QString QgsFilterLineEditPlugin::includeFile() const
{
return "qgsfilterlineedit.h";
}

QIcon QgsFilterLineEditPlugin::icon() const
{
return QIcon();
}

bool QgsFilterLineEditPlugin::isContainer() const
{
return false;
}

QWidget *QgsFilterLineEditPlugin::createWidget( QWidget *parent )
{
return new QgsFilterLineEdit( parent );
}

bool QgsFilterLineEditPlugin::isInitialized() const
{
return mInitialized;
}

void QgsFilterLineEditPlugin::initialize( QDesignerFormEditorInterface *core )
{
Q_UNUSED( core );
if ( mInitialized )
return;
mInitialized = true;
}


QString QgsFilterLineEditPlugin::toolTip() const
{
return "";
}

QString QgsFilterLineEditPlugin::whatsThis() const
{
return "";
}

QString QgsFilterLineEditPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mLineEdit\">\n"
" <property name=\"qgisRelation\" >\n"
" <string notr=\"true\"></string>\n"
" </property>\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>60</width>\n"
" <height>27</height>\n"
" </rect>\n"
" </property>\n"
" </widget>\n"
"</ui>\n" )
.arg( name() );
}
48 changes: 48 additions & 0 deletions src/customwidgets/qgsfilterlineeditplugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/***************************************************************************
qgsfilterlineeditplugin.h
--------------------------------------
Date : 20.08.2014
Copyright : (C) 2014 Denis Rouzaud
Email : denis.rouzaud@gmail.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 QGSFILTERLINEEDITPLUGIN_H
#define QGSFILTERLINEEDITPLUGIN_H

#include <QDesignerExportWidget>
#include <QDesignerCustomWidgetInterface>


class CUSTOMWIDGETS_EXPORT QgsFilterLineEditPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES( QDesignerCustomWidgetInterface )

public:
explicit QgsFilterLineEditPlugin( QObject *parent = 0 );

private:
bool mInitialized;

// QDesignerCustomWidgetInterface interface
public:
QString name() const;
QString group() const;
QString includeFile() const;
QIcon icon() const;
bool isContainer() const;
QWidget *createWidget( QWidget *parent );
bool isInitialized() const;
void initialize( QDesignerFormEditorInterface *core );
QString toolTip() const;
QString whatsThis() const;
QString domXml() const;
};
#endif // QGSFILTERLINEEDITPLUGIN_H
4 changes: 4 additions & 0 deletions src/gui/qgsfilterlineedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ class QToolButton;
class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
{
Q_OBJECT
Q_PROPERTY( QString nullValue READ nullValue WRITE setNullValue )

public:
QgsFilterLineEdit( QWidget* parent = 0, QString nullValue = QString::null );

void setNullValue( QString nullValue ) { mNullValue = nullValue; }

QString nullValue() const {return mNullValue;}

signals:
void cleared();

Expand Down

0 comments on commit f97d5e3

Please sign in to comment.