mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Rename QgsFieldKit to QgsFieldFormatter
This commit is contained in:
parent
f294201e7b
commit
22c492e6e5
@ -980,10 +980,10 @@ QgsEditorWidgetFactory {#qgis_api_break_3_0_QgsEditorWidgetFactory}
|
||||
from and to a QVariantMap automatically.
|
||||
- `writeConfig` has been removed. The configuration is read and written
|
||||
from and to a QVariantMap automatically.
|
||||
- `representValue` has been removed. Use QgsFieldKit::representValue() instead
|
||||
- `sortValue` has been removed. Use QgsFieldKit::representValue() instead
|
||||
- `alignmentFlag` has been removed. Use QgsFieldKit::representValue() instead
|
||||
- `createCache` has been removed. Use QgsFieldKit::representValue() instead
|
||||
- `representValue` has been removed. Use QgsFieldFormatter::representValue() instead
|
||||
- `sortValue` has been removed. Use QgsFieldFormatter::representValue() instead
|
||||
- `alignmentFlag` has been removed. Use QgsFieldFormatter::representValue() instead
|
||||
- `createCache` has been removed. Use QgsFieldFormatter::representValue() instead
|
||||
|
||||
|
||||
QgsGraduatedRenderer {#qgis_api_break_3_0_QgsGraduatedRenderer}
|
||||
|
@ -101,7 +101,7 @@ INCLUDE_DIRECTORIES(
|
||||
../src/core/composer
|
||||
../src/core/diagram
|
||||
../src/core/effects
|
||||
../src/core/fieldkit
|
||||
../src/core/fieldformatter
|
||||
../src/core/dxf
|
||||
../src/core/geometry
|
||||
../src/core/gps
|
||||
|
@ -60,8 +60,8 @@
|
||||
%Include qgsfield.sip
|
||||
%Include qgsfieldconstraints.sip
|
||||
%Include qgsfields.sip
|
||||
%Include qgsfieldkitregistry.sip
|
||||
%Include qgsfieldkit.sip
|
||||
%Include qgsfieldformatterregistry.sip
|
||||
%Include qgsfieldformatter.sip
|
||||
%Include qgsgeometrysimplifier.sip
|
||||
%Include qgsgeometryvalidator.sip
|
||||
%Include qgsgml.sip
|
||||
@ -243,13 +243,13 @@
|
||||
%Include gps/qgsnmeaconnection.sip
|
||||
%Include gps/qgsqtlocationconnection.sip
|
||||
|
||||
%Include fieldkit/qgsdatetimefieldkit.sip
|
||||
%Include fieldkit/qgsfallbackfieldkit.sip
|
||||
%Include fieldkit/qgskeyvaluefieldkit.sip
|
||||
%Include fieldkit/qgslistfieldkit.sip
|
||||
%Include fieldkit/qgsrelationreferencefieldkit.sip
|
||||
%Include fieldkit/qgsvaluemapfieldkit.sip
|
||||
%Include fieldkit/qgsvaluerelationfieldkit.sip
|
||||
%Include fieldformatter/qgsdatetimefieldformatter.sip
|
||||
%Include fieldformatter/qgsfallbackfieldformatter.sip
|
||||
%Include fieldformatter/qgskeyvaluefieldformatter.sip
|
||||
%Include fieldformatter/qgslistfieldformatter.sip
|
||||
%Include fieldformatter/qgsrelationreferencefieldformatter.sip
|
||||
%Include fieldformatter/qgsvaluemapfieldformatter.sip
|
||||
%Include fieldformatter/qgsvaluerelationfieldformatter.sip
|
||||
|
||||
%Include layertree/qgslayertree.sip
|
||||
%Include layertree/qgslayertreegroup.sip
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsdatetimefieldkit.sip - QgsDateTimeFieldKit
|
||||
qgsdatetimefieldformatter.sip - QgsDateTimeFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -13,13 +13,13 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
class QgsDateTimeFieldKit : QgsFieldKit
|
||||
class QgsDateTimeFieldFormatter : QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsdatetimefieldkit.h"
|
||||
#include "qgsdatetimefieldformatter.h"
|
||||
%End
|
||||
public:
|
||||
QgsDateTimeFieldKit();
|
||||
QgsDateTimeFieldFormatter();
|
||||
|
||||
QString id() const;
|
||||
|
9
python/core/fieldformatter/qgsfallbackfieldformatter.sip
Normal file
9
python/core/fieldformatter/qgsfallbackfieldformatter.sip
Normal file
@ -0,0 +1,9 @@
|
||||
class QgsFallbackFieldFormatter : QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsfallbackfieldformatter.h"
|
||||
%End
|
||||
public:
|
||||
QgsFallbackFieldFormatter();
|
||||
QString id() const;
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgskeyvaluefieldkit.sip - QgsKeyValueFieldKit
|
||||
qgskeyvaluefieldformatter.sip - QgsKeyValueFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,13 +13,13 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
class QgsKeyValueFieldKit : QgsFieldKit
|
||||
class QgsKeyValueFieldFormatter : QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgskeyvaluefieldkit.h"
|
||||
#include "qgskeyvaluefieldformatter.h"
|
||||
%End
|
||||
public:
|
||||
QgsKeyValueFieldKit();
|
||||
QgsKeyValueFieldFormatter();
|
||||
QString id() const;
|
||||
QString representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgslistfieldkit.sip - QgsListFieldKit
|
||||
qgslistfieldformatter.sip - QgsListFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,14 +13,14 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
class QgsListFieldKit : QgsFieldKit
|
||||
class QgsListFieldFormatter : QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgslistfieldkit.h"
|
||||
#include "qgslistfieldformatter.h"
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsListFieldKit();
|
||||
QgsListFieldFormatter();
|
||||
|
||||
QString id() const;
|
||||
|
@ -1,10 +1,10 @@
|
||||
class QgsRelationReferenceFieldKit : QgsFieldKit
|
||||
class QgsRelationReferenceFieldFormatter : QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsrelationreferencefieldkit.h"
|
||||
#include "qgsrelationreferencefieldformatter.h"
|
||||
%End
|
||||
public:
|
||||
QgsRelationReferenceFieldKit();
|
||||
QgsRelationReferenceFieldFormatter();
|
||||
|
||||
QString id() const;
|
||||
virtual QString representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvaluemapfieldkit.sip - QgsValueMapFieldKit
|
||||
qgsvaluemapfieldformatter.sip - QgsValueMapFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,13 +13,13 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
class QgsValueMapFieldKit : QgsFieldKit
|
||||
class QgsValueMapFieldFormatter : QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsvaluemapfieldkit.h"
|
||||
#include "qgsvaluemapfieldformatter.h"
|
||||
%End
|
||||
public:
|
||||
QgsValueMapFieldKit();
|
||||
QgsValueMapFieldFormatter();
|
||||
|
||||
QString id() const;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvaluerelationfieldkit.sip - QgsValueRelationFieldKit
|
||||
qgsvaluerelationfieldformatter.sip - QgsValueRelationFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,10 +13,10 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
class QgsValueRelationFieldKit : QgsFieldKit
|
||||
class QgsValueRelationFieldFormatter : QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsvaluerelationfieldkit.h"
|
||||
#include "qgsvaluerelationfieldformatter.h"
|
||||
%End
|
||||
|
||||
public:
|
||||
@ -30,9 +30,9 @@ class QgsValueRelationFieldKit : QgsFieldKit
|
||||
QString value;
|
||||
};
|
||||
|
||||
typedef QVector < QgsValueRelationFieldKit::ValueRelationItem > ValueRelationCache;
|
||||
typedef QVector < QgsValueRelationFieldFormatter::ValueRelationItem > ValueRelationCache;
|
||||
|
||||
QgsValueRelationFieldKit();
|
||||
QgsValueRelationFieldFormatter();
|
||||
|
||||
QString id() const;
|
||||
QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
|
||||
@ -41,5 +41,5 @@ class QgsValueRelationFieldKit : QgsFieldKit
|
||||
|
||||
QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
|
||||
|
||||
static QgsValueRelationFieldKit::ValueRelationCache createCache( const QVariantMap& config );
|
||||
static QgsValueRelationFieldFormatter::ValueRelationCache createCache( const QVariantMap& config );
|
||||
};
|
@ -1,9 +0,0 @@
|
||||
class QgsFallbackFieldKit : QgsFieldKit
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsfallbackfieldkit.h"
|
||||
%End
|
||||
public:
|
||||
QgsFallbackFieldKit();
|
||||
QString id() const;
|
||||
};
|
@ -399,11 +399,11 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
|
||||
static QgsRuntimeProfiler* profiler();
|
||||
|
||||
/**
|
||||
* Provides access to the field kit registry.
|
||||
* Provides access to the field formatter registry.
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
static QgsFieldKitRegistry* fieldKitRegistry();
|
||||
static QgsFieldFormatterRegistry* fieldKitRegistry();
|
||||
public slots:
|
||||
|
||||
/** Causes the application instance to emit the settingsChanged() signal. This should
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsfieldkit.sip - QgsFieldKit
|
||||
qgsfieldformatter.sip - QgsFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -13,15 +13,15 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
class QgsFieldKit
|
||||
class QgsFieldFormatter
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
%End
|
||||
public:
|
||||
QgsFieldKit();
|
||||
QgsFieldFormatter();
|
||||
|
||||
virtual ~QgsFieldKit();
|
||||
virtual ~QgsFieldFormatter();
|
||||
|
||||
virtual QString id() const = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsfieldkitregistry.sip - QgsFieldKitRegistry
|
||||
qgsfieldformatterregistry.sip - QgsFieldFormatterRegistry
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -13,24 +13,24 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
class QgsFieldKitRegistry : QObject
|
||||
class QgsFieldFormatterRegistry : QObject
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldformatterregistry.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsFieldKitRegistry();
|
||||
~QgsFieldKitRegistry();
|
||||
QgsFieldFormatterRegistry();
|
||||
~QgsFieldFormatterRegistry();
|
||||
|
||||
void addFieldKit( QgsFieldKit* kit /Transfer/ );
|
||||
void addFieldFormatter( QgsFieldFormatter* kit /Transfer/ );
|
||||
|
||||
void removeFieldKit( QgsFieldKit* kit );
|
||||
void removeFieldFormatter( QgsFieldFormatter* kit );
|
||||
|
||||
QgsFieldKit* fieldKit( const QString& id ) const;
|
||||
QgsFieldFormatter* fieldKit( const QString& id ) const;
|
||||
|
||||
signals:
|
||||
void fieldKitAdded( QgsFieldKit* kit );
|
||||
void fieldKitAdded( QgsFieldFormatter* kit );
|
||||
|
||||
void fieldKitRemoved( QgsFieldKit* kit );
|
||||
void fieldKitRemoved( QgsFieldFormatter* kit );
|
||||
};
|
@ -149,8 +149,8 @@
|
||||
#include "qgsfeature.h"
|
||||
#include "qgsformannotationitem.h"
|
||||
#include "qgsfieldcalculator.h"
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
#include "qgsfieldformatterregistry.h"
|
||||
#include "qgshtmlannotationitem.h"
|
||||
#include "qgsgenericprojectionselector.h"
|
||||
#include "qgsgpsinformationwidget.h"
|
||||
@ -6399,7 +6399,7 @@ QVariant QgisAppFieldValueConverter::convert( int idx, const QVariant& value )
|
||||
return value;
|
||||
}
|
||||
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( mLayer, mLayer->fields().field( idx ).name() );
|
||||
QgsFieldKit* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
QgsFieldFormatter* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
return fieldKit->representValue( mLayer, idx, setup.config(), QVariant(), value );
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "qgisapp.h"
|
||||
#include "qgsproject.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatterregistry.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
#include "qgseditorwidgetfactory.h"
|
||||
#include "qgseditorwidgetregistry.h"
|
||||
|
||||
@ -350,7 +350,7 @@ void QgsAttributeTypeDialog::defaultExpressionChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
QgsFieldKit* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( editorWidgetType() );
|
||||
QgsFieldFormatter* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( editorWidgetType() );
|
||||
|
||||
QString previewText = fieldKit->representValue( mLayer, mFieldIdx, editorWidgetConfig(), QVariant(), val );
|
||||
|
||||
|
@ -43,8 +43,8 @@
|
||||
#include "qgsstringutils.h"
|
||||
#include "qgstreewidgetitem.h"
|
||||
#include "qgsfiledownloader.h"
|
||||
#include "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatterregistry.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QLabel>
|
||||
@ -734,7 +734,7 @@ QString QgsIdentifyResultsDialog::representValue( QgsVectorLayer* vlayer, const
|
||||
QMap<QString, QVariant>& layerCaches = mWidgetCaches[vlayer->id()];
|
||||
|
||||
QgsEditorWidgetFactory* factory = QgsEditorWidgetRegistry::instance()->factory( setup.type() );
|
||||
QgsFieldKit* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
QgsFieldFormatter* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
|
||||
int idx = vlayer->fields().lookupField( fieldName );
|
||||
|
||||
|
@ -127,8 +127,8 @@ SET(QGIS_CORE_SRCS
|
||||
qgsfeaturestore.cpp
|
||||
qgsfield.cpp
|
||||
qgsfieldconstraints.cpp
|
||||
qgsfieldkit.cpp
|
||||
qgsfieldkitregistry.cpp
|
||||
qgsfieldformatter.cpp
|
||||
qgsfieldformatterregistry.cpp
|
||||
qgsfields.cpp
|
||||
qgsfontutils.cpp
|
||||
qgsgeometrycache.cpp
|
||||
@ -370,13 +370,13 @@ SET(QGIS_CORE_SRCS
|
||||
geometry/qgswkbtypes.cpp
|
||||
|
||||
|
||||
fieldkit/qgsdatetimefieldkit.cpp
|
||||
fieldkit/qgsfallbackfieldkit.cpp
|
||||
fieldkit/qgskeyvaluefieldkit.cpp
|
||||
fieldkit/qgslistfieldkit.cpp
|
||||
fieldkit/qgsrelationreferencefieldkit.cpp
|
||||
fieldkit/qgsvaluemapfieldkit.cpp
|
||||
fieldkit/qgsvaluerelationfieldkit.cpp
|
||||
fieldformatter/qgsdatetimefieldformatter.cpp
|
||||
fieldformatter/qgsfallbackfieldformatter.cpp
|
||||
fieldformatter/qgskeyvaluefieldformatter.cpp
|
||||
fieldformatter/qgslistfieldformatter.cpp
|
||||
fieldformatter/qgsrelationreferencefieldformatter.cpp
|
||||
fieldformatter/qgsvaluemapfieldformatter.cpp
|
||||
fieldformatter/qgsvaluerelationfieldformatter.cpp
|
||||
|
||||
${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp
|
||||
@ -478,7 +478,7 @@ SET(QGIS_CORE_MOC_HDRS
|
||||
qgsfeedback.h
|
||||
qgsfield.h
|
||||
qgsfieldconstraints.h
|
||||
qgsfieldkitregistry.h
|
||||
qgsfieldformatterregistry.h
|
||||
qgsgeometryvalidator.h
|
||||
qgsgml.h
|
||||
qgsgmlschema.h
|
||||
@ -670,7 +670,7 @@ SET(QGIS_CORE_HDRS
|
||||
qgsfeatureiterator.h
|
||||
qgsfeaturerequest.h
|
||||
qgsfeaturestore.h
|
||||
qgsfieldkit.h
|
||||
qgsfieldformatter.h
|
||||
qgsfields.h
|
||||
qgsfontutils.h
|
||||
qgsgeometrycache.h
|
||||
@ -888,13 +888,13 @@ SET(QGIS_CORE_HDRS
|
||||
geometry/qgswkbptr.h
|
||||
geometry/qgswkbtypes.h
|
||||
|
||||
fieldkit/qgsdatetimefieldkit.h
|
||||
fieldkit/qgsfallbackfieldkit.h
|
||||
fieldkit/qgskeyvaluefieldkit.h
|
||||
fieldkit/qgslistfieldkit.h
|
||||
fieldkit/qgsrelationreferencefieldkit.h
|
||||
fieldkit/qgsvaluemapfieldkit.h
|
||||
fieldkit/qgsvaluerelationfieldkit.h
|
||||
fieldformatter/qgsdatetimefieldformatter.h
|
||||
fieldformatter/qgsfallbackfieldformatter.h
|
||||
fieldformatter/qgskeyvaluefieldformatter.h
|
||||
fieldformatter/qgslistfieldformatter.h
|
||||
fieldformatter/qgsrelationreferencefieldformatter.h
|
||||
fieldformatter/qgsvaluemapfieldformatter.h
|
||||
fieldformatter/qgsvaluerelationfieldformatter.h
|
||||
)
|
||||
|
||||
IF (QT_MOBILITY_LOCATION_FOUND OR Qt5Positioning_FOUND)
|
||||
@ -910,7 +910,7 @@ INCLUDE_DIRECTORIES(
|
||||
composer
|
||||
dxf
|
||||
effects
|
||||
fieldkit
|
||||
fieldformatter
|
||||
geometry
|
||||
layertree
|
||||
pal
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsdatetimefieldkit.cpp - QgsDateTimeFieldKit
|
||||
qgsdatetimefieldformatter.cpp - QgsDateTimeFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -13,24 +13,24 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsdatetimefieldkit.h"
|
||||
#include "qgsdatetimefieldformatter.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include "qgsfield.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
QgsDateTimeFieldKit::QgsDateTimeFieldKit()
|
||||
QgsDateTimeFieldFormatter::QgsDateTimeFieldFormatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QgsDateTimeFieldKit::id() const
|
||||
QString QgsDateTimeFieldFormatter::id() const
|
||||
{
|
||||
return QStringLiteral( "DateTime" );
|
||||
}
|
||||
|
||||
QString QgsDateTimeFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QString QgsDateTimeFieldFormatter::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( cache )
|
||||
|
||||
@ -60,7 +60,7 @@ QString QgsDateTimeFieldKit::representValue( QgsVectorLayer* layer, int fieldInd
|
||||
return result;
|
||||
}
|
||||
|
||||
QString QgsDateTimeFieldKit::defaultFormat( const QVariant::Type type )
|
||||
QString QgsDateTimeFieldFormatter::defaultFormat( const QVariant::Type type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsdatetimefieldkit.h - QgsDateTimeFieldKit
|
||||
qgsdatetimefieldformatter.h - QgsDateTimeFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -16,16 +16,16 @@
|
||||
#ifndef QGSDATETIMEFIELDKIT_H
|
||||
#define QGSDATETIMEFIELDKIT_H
|
||||
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
#define QGSDATETIMEFIELDKIT_DATEFORMAT QStringLiteral( "yyyy-MM-dd" )
|
||||
#define QGSDATETIMEFIELDKIT_TIMEFORMAT QStringLiteral( "HH:mm:ss" )
|
||||
#define QGSDATETIMEFIELDKIT_DATETIMEFORMAT QStringLiteral( "yyyy-MM-dd HH:mm:ss" )
|
||||
|
||||
class CORE_EXPORT QgsDateTimeFieldKit : public QgsFieldKit
|
||||
class CORE_EXPORT QgsDateTimeFieldFormatter : public QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
QgsDateTimeFieldKit();
|
||||
QgsDateTimeFieldFormatter();
|
||||
|
||||
QString id() const override;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsfallbackfieldkit.cpp - QgsFallbackFieldKit
|
||||
qgsfallbackfieldformatter.cpp - QgsFallbackFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 4.12.2016
|
||||
@ -13,14 +13,14 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsfallbackfieldkit.h"
|
||||
#include "qgsfallbackfieldformatter.h"
|
||||
|
||||
QgsFallbackFieldKit::QgsFallbackFieldKit()
|
||||
QgsFallbackFieldFormatter::QgsFallbackFieldFormatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QgsFallbackFieldKit::id() const
|
||||
QString QgsFallbackFieldFormatter::id() const
|
||||
{
|
||||
return QString();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsfallbackfieldkit.h - QgsFallbackFieldKit
|
||||
qgsfallbackfieldformatter.h - QgsFallbackFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 4.12.2016
|
||||
@ -16,12 +16,12 @@
|
||||
#ifndef QGSFALLBACKFIELDKIT_H
|
||||
#define QGSFALLBACKFIELDKIT_H
|
||||
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
class CORE_EXPORT QgsFallbackFieldKit : public QgsFieldKit
|
||||
class CORE_EXPORT QgsFallbackFieldFormatter : public QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
QgsFallbackFieldKit();
|
||||
QgsFallbackFieldFormatter();
|
||||
|
||||
QString id() const override;
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgskeyvaluefieldkit.cpp - QgsKeyValueFieldKit
|
||||
qgskeyvaluefieldformatter.cpp - QgsKeyValueFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,21 +13,21 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgskeyvaluefieldkit.h"
|
||||
#include "qgskeyvaluefieldformatter.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
QgsKeyValueFieldKit::QgsKeyValueFieldKit()
|
||||
QgsKeyValueFieldFormatter::QgsKeyValueFieldFormatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QgsKeyValueFieldKit::id() const
|
||||
QString QgsKeyValueFieldFormatter::id() const
|
||||
{
|
||||
return QStringLiteral( "KeyValue" );
|
||||
}
|
||||
|
||||
QString QgsKeyValueFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QString QgsKeyValueFieldFormatter::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( layer );
|
||||
Q_UNUSED( fieldIndex );
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgskeyvaluefieldkit.h - QgsKeyValueFieldKit
|
||||
qgskeyvaluefieldformatter.h - QgsKeyValueFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -16,12 +16,12 @@
|
||||
#ifndef QGSKEYVALUEFIELDKIT_H
|
||||
#define QGSKEYVALUEFIELDKIT_H
|
||||
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
class CORE_EXPORT QgsKeyValueFieldKit : public QgsFieldKit
|
||||
class CORE_EXPORT QgsKeyValueFieldFormatter : public QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
QgsKeyValueFieldKit();
|
||||
QgsKeyValueFieldFormatter();
|
||||
|
||||
QString id() const override;
|
||||
QString representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const override;
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgslistfieldkit.cpp - QgsListFieldKit
|
||||
qgslistfieldformatter.cpp - QgsListFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,21 +13,21 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgslistfieldkit.h"
|
||||
#include "qgslistfieldformatter.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
QgsListFieldKit::QgsListFieldKit()
|
||||
QgsListFieldFormatter::QgsListFieldFormatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QgsListFieldKit::id() const
|
||||
QString QgsListFieldFormatter::id() const
|
||||
{
|
||||
return QStringLiteral( "List" );
|
||||
}
|
||||
|
||||
QString QgsListFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QString QgsListFieldFormatter::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( layer );
|
||||
Q_UNUSED( fieldIndex );
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgslistfieldkit.h - QgsListFieldKit
|
||||
qgslistfieldformatter.h - QgsListFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -16,12 +16,12 @@
|
||||
#ifndef QGSLISTFIELDKIT_H
|
||||
#define QGSLISTFIELDKIT_H
|
||||
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
class CORE_EXPORT QgsListFieldKit : public QgsFieldKit
|
||||
class CORE_EXPORT QgsListFieldFormatter : public QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
QgsListFieldKit();
|
||||
QgsListFieldFormatter();
|
||||
|
||||
QString id() const override;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsrelationreferencefieldkit.cpp - QgsRelationReferenceFieldKit
|
||||
qgsrelationreferencefieldformatter.cpp - QgsRelationReferenceFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,7 +13,7 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsrelationreferencefieldkit.h"
|
||||
#include "qgsrelationreferencefieldformatter.h"
|
||||
|
||||
#include "qgsmessagelog.h"
|
||||
#include "qgsrelation.h"
|
||||
@ -22,17 +22,17 @@
|
||||
#include "qgsrelationmanager.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
QgsRelationReferenceFieldKit::QgsRelationReferenceFieldKit()
|
||||
QgsRelationReferenceFieldFormatter::QgsRelationReferenceFieldFormatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QgsRelationReferenceFieldKit::id() const
|
||||
QString QgsRelationReferenceFieldFormatter::id() const
|
||||
{
|
||||
return QStringLiteral( "RelationReference" );
|
||||
}
|
||||
|
||||
QString QgsRelationReferenceFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QString QgsRelationReferenceFieldFormatter::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( cache );
|
||||
|
||||
@ -93,7 +93,7 @@ QString QgsRelationReferenceFieldKit::representValue( QgsVectorLayer* layer, int
|
||||
return title;
|
||||
}
|
||||
|
||||
QVariant QgsRelationReferenceFieldKit::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QVariant QgsRelationReferenceFieldFormatter::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
return representValue( layer, fieldIndex, config, cache, value );
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsrelationreferencefieldkit.h - QgsRelationReferenceFieldKit
|
||||
qgsrelationreferencefieldformatter.h - QgsRelationReferenceFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -16,12 +16,12 @@
|
||||
#ifndef QGSRELATIONREFERENCEFIELDKIT_H
|
||||
#define QGSRELATIONREFERENCEFIELDKIT_H
|
||||
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
class CORE_EXPORT QgsRelationReferenceFieldKit : public QgsFieldKit
|
||||
class CORE_EXPORT QgsRelationReferenceFieldFormatter : public QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
QgsRelationReferenceFieldKit();
|
||||
QgsRelationReferenceFieldFormatter();
|
||||
|
||||
QString id() const override;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvaluemapfieldkit.cpp - QgsValueMapFieldKit
|
||||
qgsvaluemapfieldformatter.cpp - QgsValueMapFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,21 +13,21 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsvaluemapfieldkit.h"
|
||||
#include "qgsvaluemapfieldformatter.h"
|
||||
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
QgsValueMapFieldKit::QgsValueMapFieldKit()
|
||||
QgsValueMapFieldFormatter::QgsValueMapFieldFormatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QgsValueMapFieldKit::id() const
|
||||
QString QgsValueMapFieldFormatter::id() const
|
||||
{
|
||||
return QStringLiteral( "ValueMap" );
|
||||
}
|
||||
|
||||
QString QgsValueMapFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QString QgsValueMapFieldFormatter::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( cache )
|
||||
|
||||
@ -42,7 +42,7 @@ QString QgsValueMapFieldKit::representValue( QgsVectorLayer* layer, int fieldInd
|
||||
return map.key( valueInternalText, QVariant( QStringLiteral( "(%1)" ).arg( layer->fields().at( fieldIndex ).displayString( value ) ) ).toString() );
|
||||
}
|
||||
|
||||
QVariant QgsValueMapFieldKit::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QVariant QgsValueMapFieldFormatter::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
return representValue( layer, fieldIndex, config, cache, value );
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvaluemapfieldkit.h - QgsValueMapFieldKit
|
||||
qgsvaluemapfieldformatter.h - QgsValueMapFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -16,14 +16,14 @@
|
||||
#ifndef QGSVALUEMAPFIELDKIT_H
|
||||
#define QGSVALUEMAPFIELDKIT_H
|
||||
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
#define VALUEMAP_NULL_TEXT QStringLiteral( "{2839923C-8B7D-419E-B84B-CA2FE9B80EC7}" )
|
||||
|
||||
class CORE_EXPORT QgsValueMapFieldKit : public QgsFieldKit
|
||||
class CORE_EXPORT QgsValueMapFieldFormatter : public QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
QgsValueMapFieldKit();
|
||||
QgsValueMapFieldFormatter();
|
||||
|
||||
QString id() const override;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvaluerelationfieldkit.cpp - QgsValueRelationFieldKit
|
||||
qgsvaluerelationfieldformatter.cpp - QgsValueRelationFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -13,7 +13,7 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsvaluerelationfieldkit.h"
|
||||
#include "qgsvaluerelationfieldformatter.h"
|
||||
|
||||
#include "qgis.h"
|
||||
#include "qgsproject.h"
|
||||
@ -21,41 +21,41 @@
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
bool orderByKeyLessThan( const QgsValueRelationFieldKit::ValueRelationItem& p1, const QgsValueRelationFieldKit::ValueRelationItem& p2 )
|
||||
bool orderByKeyLessThan( const QgsValueRelationFieldFormatter::ValueRelationItem& p1, const QgsValueRelationFieldFormatter::ValueRelationItem& p2 )
|
||||
{
|
||||
return qgsVariantLessThan( p1.key, p2.key );
|
||||
}
|
||||
|
||||
bool orderByValueLessThan( const QgsValueRelationFieldKit::ValueRelationItem& p1, const QgsValueRelationFieldKit::ValueRelationItem& p2 )
|
||||
bool orderByValueLessThan( const QgsValueRelationFieldFormatter::ValueRelationItem& p1, const QgsValueRelationFieldFormatter::ValueRelationItem& p2 )
|
||||
{
|
||||
return qgsVariantLessThan( p1.value, p2.value );
|
||||
}
|
||||
|
||||
|
||||
QgsValueRelationFieldKit::QgsValueRelationFieldKit()
|
||||
QgsValueRelationFieldFormatter::QgsValueRelationFieldFormatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QgsValueRelationFieldKit::id() const
|
||||
QString QgsValueRelationFieldFormatter::id() const
|
||||
{
|
||||
return QStringLiteral( "ValueRelation" );
|
||||
}
|
||||
|
||||
QString QgsValueRelationFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QString QgsValueRelationFieldFormatter::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( layer )
|
||||
Q_UNUSED( fieldIndex )
|
||||
|
||||
QgsValueRelationFieldKit::ValueRelationCache vrCache;
|
||||
QgsValueRelationFieldFormatter::ValueRelationCache vrCache;
|
||||
|
||||
if ( cache.isValid() )
|
||||
{
|
||||
vrCache = cache.value<QgsValueRelationFieldKit::ValueRelationCache>();
|
||||
vrCache = cache.value<QgsValueRelationFieldFormatter::ValueRelationCache>();
|
||||
}
|
||||
else
|
||||
{
|
||||
vrCache = QgsValueRelationFieldKit::createCache( config );
|
||||
vrCache = QgsValueRelationFieldFormatter::createCache( config );
|
||||
}
|
||||
|
||||
if ( config.value( "AllowMulti" ).toBool() )
|
||||
@ -63,7 +63,7 @@ QString QgsValueRelationFieldKit::representValue( QgsVectorLayer* layer, int fie
|
||||
QStringList keyList = value.toString().remove( QChar( '{' ) ).remove( QChar( '}' ) ).split( ',' );
|
||||
QStringList valueList;
|
||||
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& item, vrCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& item, vrCache )
|
||||
{
|
||||
if ( keyList.contains( item.key.toString() ) )
|
||||
{
|
||||
@ -81,7 +81,7 @@ QString QgsValueRelationFieldKit::representValue( QgsVectorLayer* layer, int fie
|
||||
return settings.value( "qgis/nullValue", "NULL" ).toString();
|
||||
}
|
||||
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& item, vrCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& item, vrCache )
|
||||
{
|
||||
if ( item.key == value )
|
||||
{
|
||||
@ -93,12 +93,12 @@ QString QgsValueRelationFieldKit::representValue( QgsVectorLayer* layer, int fie
|
||||
return QString( "(%1)" ).arg( value.toString() );
|
||||
}
|
||||
|
||||
QVariant QgsValueRelationFieldKit::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QVariant QgsValueRelationFieldFormatter::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
return representValue( layer, fieldIndex, config, cache, value );
|
||||
}
|
||||
|
||||
QVariant QgsValueRelationFieldKit::createCache( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const
|
||||
QVariant QgsValueRelationFieldFormatter::createCache( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const
|
||||
{
|
||||
Q_UNUSED( layer )
|
||||
Q_UNUSED( fieldIndex )
|
||||
@ -106,11 +106,11 @@ QVariant QgsValueRelationFieldKit::createCache( QgsVectorLayer* layer, int field
|
||||
|
||||
}
|
||||
|
||||
QgsValueRelationFieldKit::ValueRelationCache QgsValueRelationFieldKit::createCache( const QVariantMap& config )
|
||||
QgsValueRelationFieldFormatter::ValueRelationCache QgsValueRelationFieldFormatter::createCache( const QVariantMap& config )
|
||||
{
|
||||
ValueRelationCache cache;
|
||||
|
||||
QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( config.value( "Layer" ).toString() ) );
|
||||
QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( QgsProject::instance()->mapLayer( config.value( "Layer" ).toString() ) );
|
||||
|
||||
if ( !layer )
|
||||
return cache;
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvaluerelationfieldkit.h - QgsValueRelationFieldKit
|
||||
qgsvaluerelationfieldformatter.h - QgsValueRelationFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 3.12.2016
|
||||
@ -16,12 +16,12 @@
|
||||
#ifndef QGSVALUERELATIONFIELDKIT_H
|
||||
#define QGSVALUERELATIONFIELDKIT_H
|
||||
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
#include <QVector>
|
||||
#include <QVariant>
|
||||
|
||||
class CORE_EXPORT QgsValueRelationFieldKit : public QgsFieldKit
|
||||
class CORE_EXPORT QgsValueRelationFieldFormatter : public QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
struct ValueRelationItem
|
||||
@ -40,7 +40,7 @@ class CORE_EXPORT QgsValueRelationFieldKit : public QgsFieldKit
|
||||
|
||||
typedef QVector < ValueRelationItem > ValueRelationCache;
|
||||
|
||||
QgsValueRelationFieldKit();
|
||||
QgsValueRelationFieldFormatter();
|
||||
|
||||
QString id() const override;
|
||||
QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const override;
|
||||
@ -52,6 +52,6 @@ class CORE_EXPORT QgsValueRelationFieldKit : public QgsFieldKit
|
||||
static ValueRelationCache createCache( const QVariantMap& config );
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( QgsValueRelationFieldKit::ValueRelationCache )
|
||||
Q_DECLARE_METATYPE( QgsValueRelationFieldFormatter::ValueRelationCache )
|
||||
|
||||
#endif // QGSVALUERELATIONFIELDKIT_H
|
@ -26,7 +26,7 @@
|
||||
#include "qgsactionscoperegistry.h"
|
||||
#include "qgsruntimeprofiler.h"
|
||||
#include "qgstaskmanager.h"
|
||||
#include "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldformatterregistry.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@ -112,7 +112,7 @@ QgsApplication::QgsApplication( int & argc, char ** argv, bool GUIenabled, const
|
||||
mTaskManager = new QgsTaskManager();
|
||||
mProfiler = new QgsRuntimeProfiler();
|
||||
mActionScopeRegistry = new QgsActionScopeRegistry();
|
||||
mFieldKitRegistry = new QgsFieldKitRegistry();
|
||||
mFieldFormatterRegistry = new QgsFieldFormatterRegistry();
|
||||
|
||||
init( customConfigPath ); // init can also be called directly by e.g. unit tests that don't inherit QApplication.
|
||||
}
|
||||
@ -247,7 +247,7 @@ QgsApplication::~QgsApplication()
|
||||
delete mActionScopeRegistry;
|
||||
delete mTaskManager;
|
||||
delete mProfiler;
|
||||
delete mFieldKitRegistry;
|
||||
delete mFieldFormatterRegistry;
|
||||
}
|
||||
|
||||
QgsApplication* QgsApplication::instance()
|
||||
@ -1426,7 +1426,7 @@ void QgsApplication::emitSettingsChanged()
|
||||
}
|
||||
|
||||
|
||||
QgsFieldKitRegistry* QgsApplication::fieldKitRegistry()
|
||||
QgsFieldFormatterRegistry* QgsApplication::fieldKitRegistry()
|
||||
{
|
||||
return instance()->mFieldKitRegistry;
|
||||
return instance()->mFieldFormatterRegistry;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
class QgsActionScopeRegistry;
|
||||
class QgsRuntimeProfiler;
|
||||
class QgsTaskManager;
|
||||
class QgsFieldKitRegistry;
|
||||
class QgsFieldFormatterRegistry;
|
||||
|
||||
/** \ingroup core
|
||||
* Extends QApplication to provide access to QGIS specific resources such
|
||||
@ -398,9 +398,9 @@ class CORE_EXPORT QgsApplication : public QApplication
|
||||
static QgsRuntimeProfiler* profiler();
|
||||
|
||||
/**
|
||||
* Get the registry of available field kits.
|
||||
* Get the registry of available field formatters.
|
||||
*/
|
||||
static QgsFieldKitRegistry* fieldKitRegistry();
|
||||
static QgsFieldFormatterRegistry* fieldKitRegistry();
|
||||
|
||||
public slots:
|
||||
|
||||
@ -471,7 +471,7 @@ class CORE_EXPORT QgsApplication : public QApplication
|
||||
QgsActionScopeRegistry* mActionScopeRegistry;
|
||||
QgsRuntimeProfiler* mProfiler;
|
||||
QgsTaskManager* mTaskManager;
|
||||
QgsFieldKitRegistry* mFieldKitRegistry;
|
||||
QgsFieldFormatterRegistry* mFieldFormatterRegistry;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -167,7 +167,7 @@ class CORE_EXPORT QgsEditFormConfig
|
||||
*
|
||||
* @return The configuration for the editor widget or an empty config if the field does not exist
|
||||
*/
|
||||
QVariantMap widgetConfig( const QString& fieldName ) const;
|
||||
QVariantMap widgetConfig( const QString& widgetName ) const;
|
||||
|
||||
/**
|
||||
* Remove the configuration for the editor widget with the given name
|
||||
@ -176,7 +176,7 @@ class CORE_EXPORT QgsEditFormConfig
|
||||
*
|
||||
* @return true if a configuration has been removed
|
||||
*/
|
||||
bool removeWidgetConfig( const QString& fieldName );
|
||||
bool removeWidgetConfig( const QString& widgetName );
|
||||
|
||||
/**
|
||||
* This returns true if the field is manually set to read only or if the field
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsfieldkit.cpp - QgsFieldKit
|
||||
qgsfieldformatter.cpp - QgsFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -13,21 +13,21 @@
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
#include "qgsfields.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsvectordataprovider.h"
|
||||
|
||||
QgsFieldKit::QgsFieldKit()
|
||||
QgsFieldFormatter::QgsFieldFormatter()
|
||||
{
|
||||
}
|
||||
|
||||
QgsFieldKit::~QgsFieldKit()
|
||||
QgsFieldFormatter::~QgsFieldFormatter()
|
||||
{
|
||||
}
|
||||
|
||||
QString QgsFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QString QgsFieldFormatter::representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( layer )
|
||||
Q_UNUSED( fieldIndex )
|
||||
@ -42,7 +42,7 @@ QString QgsFieldKit::representValue( QgsVectorLayer* layer, int fieldIndex, cons
|
||||
return value == defVal ? defVal : layer->fields().at( fieldIndex ).displayString( value );
|
||||
}
|
||||
|
||||
QVariant QgsFieldKit::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
QVariant QgsFieldFormatter::sortValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const
|
||||
{
|
||||
Q_UNUSED( layer )
|
||||
Q_UNUSED( fieldIndex )
|
||||
@ -52,7 +52,7 @@ QVariant QgsFieldKit::sortValue( QgsVectorLayer* layer, int fieldIndex, const QV
|
||||
return value;
|
||||
}
|
||||
|
||||
Qt::AlignmentFlag QgsFieldKit::alignmentFlag( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const
|
||||
Qt::AlignmentFlag QgsFieldFormatter::alignmentFlag( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const
|
||||
{
|
||||
Q_UNUSED( config );
|
||||
|
||||
@ -66,7 +66,7 @@ Qt::AlignmentFlag QgsFieldKit::alignmentFlag( QgsVectorLayer* layer, int fieldIn
|
||||
return Qt::AlignLeft;
|
||||
}
|
||||
|
||||
QVariant QgsFieldKit::createCache( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const
|
||||
QVariant QgsFieldFormatter::createCache( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const
|
||||
{
|
||||
Q_UNUSED( layer )
|
||||
Q_UNUSED( fieldIndex )
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsfieldkit.h - QgsFieldKit
|
||||
qgsfieldformatter.h - QgsFieldFormatter
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -23,28 +23,28 @@ class QgsVectorLayer;
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
* A field kit helps to handle and display values for a field.
|
||||
* A field formatter helps to handle and display values for a field.
|
||||
*
|
||||
* It allows for using a shared configuration with the editor widgets
|
||||
* for representation of attribute values.
|
||||
* Field kits normally have one single instance which is managed by the
|
||||
* QgsFieldKitRegistry. Custom field kits should be registered there and
|
||||
* field kits for use within code should normally be obtained from there.
|
||||
* QgsFieldFormatterRegistry. Custom field formatters should be registered there and
|
||||
* field formatters for use within code should normally be obtained from there.
|
||||
*
|
||||
* This is an abstract base class and will always need to be subclassed.
|
||||
*
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
class CORE_EXPORT QgsFieldKit
|
||||
class CORE_EXPORT QgsFieldFormatter
|
||||
{
|
||||
public:
|
||||
QgsFieldKit();
|
||||
QgsFieldFormatter();
|
||||
|
||||
virtual ~QgsFieldKit();
|
||||
virtual ~QgsFieldFormatter();
|
||||
|
||||
/**
|
||||
* Return a unique id for this field kit.
|
||||
* This id will later be used to identify this field kit in the registry with QgsFieldKitRegistry::fieldKit().
|
||||
* Return a unique id for this field formatter.
|
||||
* This id will later be used to identify this field formatter in the registry with QgsFieldFormatterRegistry::fieldFormatter().
|
||||
*
|
||||
* This id matches the id of a QgsEditorWidgetFactory.
|
||||
*/
|
65
src/core/qgsfieldformatterregistry.cpp
Normal file
65
src/core/qgsfieldformatterregistry.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
qgsfieldformatterregistry.cpp - QgsFieldFormatterRegistry
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
copyright : (C) 2016 by Matthias Kuhn
|
||||
email : matthias@opengis.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 "qgsfieldformatterregistry.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
|
||||
#include "qgsvaluerelationfieldformatter.h"
|
||||
#include "qgsvaluemapfieldformatter.h"
|
||||
#include "qgsdatetimefieldformatter.h"
|
||||
#include "qgsrelationreferencefieldformatter.h"
|
||||
#include "qgskeyvaluefieldformatter.h"
|
||||
#include "qgslistfieldformatter.h"
|
||||
#include "qgsfallbackfieldformatter.h"
|
||||
|
||||
|
||||
QgsFieldFormatterRegistry::QgsFieldFormatterRegistry( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
addFieldFormatter( new QgsValueRelationFieldFormatter() );
|
||||
addFieldFormatter( new QgsValueMapFieldFormatter() );
|
||||
addFieldFormatter( new QgsRelationReferenceFieldFormatter() );
|
||||
addFieldFormatter( new QgsKeyValueFieldFormatter() );
|
||||
addFieldFormatter( new QgsListFieldFormatter() );
|
||||
addFieldFormatter( new QgsDateTimeFieldFormatter() );
|
||||
|
||||
mFallbackFieldFormatter = new QgsFallbackFieldFormatter();
|
||||
}
|
||||
|
||||
QgsFieldFormatterRegistry::~QgsFieldFormatterRegistry()
|
||||
{
|
||||
qDeleteAll( mFieldFormatters );
|
||||
delete mFallbackFieldFormatter;
|
||||
}
|
||||
|
||||
void QgsFieldFormatterRegistry::addFieldFormatter( QgsFieldFormatter* kit )
|
||||
{
|
||||
mFieldFormatters.insert( kit->id(), kit );
|
||||
emit fieldKitAdded( kit );
|
||||
}
|
||||
|
||||
void QgsFieldFormatterRegistry::removeFieldFormatter( QgsFieldFormatter* kit )
|
||||
{
|
||||
if ( mFieldFormatters.remove( kit->id() ) )
|
||||
{
|
||||
emit fieldKitRemoved( kit );
|
||||
delete kit;
|
||||
}
|
||||
}
|
||||
|
||||
QgsFieldFormatter* QgsFieldFormatterRegistry::fieldKit( const QString& id ) const
|
||||
{
|
||||
return mFieldFormatters.value( id, mFallbackFieldFormatter );
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsfieldkitregistry.h - QgsFieldKitRegistry
|
||||
qgsfieldformatterregistry.h - QgsFieldFormatterRegistry
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
@ -20,29 +20,29 @@
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
|
||||
class QgsFieldKit;
|
||||
class QgsFieldFormatter;
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
* The QgsFieldKitRegistry manages registered classes of QgsFieldKit.
|
||||
* A reference to the QgsFieldKitRegistry can be obtained from
|
||||
* The QgsFieldFormatterRegistry manages registered classes of QgsFieldFormatter.
|
||||
* A reference to the QgsFieldFormatterRegistry can be obtained from
|
||||
* QgsApplication::fieldKitRegistry().
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
class CORE_EXPORT QgsFieldKitRegistry : public QObject
|
||||
class CORE_EXPORT QgsFieldFormatterRegistry : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* You should not normally need to create your own field kit registry.
|
||||
* You should not normally need to create your own field formatter registry.
|
||||
*
|
||||
* Use the one provided by `QgsApplication::fieldKitRegistry()` instead.
|
||||
*/
|
||||
QgsFieldKitRegistry( QObject* parent = nullptr );
|
||||
~QgsFieldKitRegistry();
|
||||
QgsFieldFormatterRegistry( QObject* parent = nullptr );
|
||||
~QgsFieldFormatterRegistry();
|
||||
|
||||
/**
|
||||
* They will take precedence in order of adding them.
|
||||
@ -50,35 +50,35 @@ class CORE_EXPORT QgsFieldKitRegistry : public QObject
|
||||
*
|
||||
* Ownership is transferred to the registry.
|
||||
*/
|
||||
void addFieldKit( QgsFieldKit* kit );
|
||||
void addFieldFormatter( QgsFieldFormatter* kit );
|
||||
|
||||
/**
|
||||
* Remove a field kit from the registry.
|
||||
* The field kit will be deleted.
|
||||
* Remove a field formatter from the registry.
|
||||
* The field formatter will be deleted.
|
||||
*/
|
||||
void removeFieldKit( QgsFieldKit* kit );
|
||||
void removeFieldFormatter( QgsFieldFormatter* kit );
|
||||
|
||||
/**
|
||||
* Get a field kit by its id. If there is no such id registered,
|
||||
* a default QgsFallbackFieldKit with a null id will be returned instead.
|
||||
* Get a field formatter by its id. If there is no such id registered,
|
||||
* a default QgsFallbackFieldFormatter with a null id will be returned instead.
|
||||
*/
|
||||
QgsFieldKit* fieldKit( const QString& id ) const;
|
||||
QgsFieldFormatter* fieldKit( const QString& id ) const;
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
* Will be emitted after a new field kit has been added.
|
||||
* Will be emitted after a new field formatter has been added.
|
||||
*/
|
||||
void fieldKitAdded( QgsFieldKit* kit );
|
||||
void fieldKitAdded( QgsFieldFormatter* kit );
|
||||
|
||||
/**
|
||||
* Will be emitted just before a field kit is removed and deleted.
|
||||
* Will be emitted just before a field formatter is removed and deleted.
|
||||
*/
|
||||
void fieldKitRemoved( QgsFieldKit* kit );
|
||||
void fieldKitRemoved( QgsFieldFormatter* kit );
|
||||
|
||||
private:
|
||||
QHash<QString, QgsFieldKit*> mFieldKits;
|
||||
QgsFieldKit* mFallbackFieldKit;
|
||||
QHash<QString, QgsFieldFormatter*> mFieldFormatters;
|
||||
QgsFieldFormatter* mFallbackFieldFormatter;
|
||||
};
|
||||
|
||||
#endif // QGSFIELDKITREGISTRY_H
|
@ -1,65 +0,0 @@
|
||||
/***************************************************************************
|
||||
qgsfieldkitregistry.cpp - QgsFieldKitRegistry
|
||||
|
||||
---------------------
|
||||
begin : 2.12.2016
|
||||
copyright : (C) 2016 by Matthias Kuhn
|
||||
email : matthias@opengis.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 "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldkit.h"
|
||||
|
||||
#include "qgsvaluerelationfieldkit.h"
|
||||
#include "qgsvaluemapfieldkit.h"
|
||||
#include "qgsdatetimefieldkit.h"
|
||||
#include "qgsrelationreferencefieldkit.h"
|
||||
#include "qgskeyvaluefieldkit.h"
|
||||
#include "qgslistfieldkit.h"
|
||||
#include "qgsfallbackfieldkit.h"
|
||||
|
||||
|
||||
QgsFieldKitRegistry::QgsFieldKitRegistry( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
addFieldKit( new QgsValueRelationFieldKit() );
|
||||
addFieldKit( new QgsValueMapFieldKit() );
|
||||
addFieldKit( new QgsRelationReferenceFieldKit() );
|
||||
addFieldKit( new QgsKeyValueFieldKit() );
|
||||
addFieldKit( new QgsListFieldKit() );
|
||||
addFieldKit( new QgsDateTimeFieldKit() );
|
||||
|
||||
mFallbackFieldKit = new QgsFallbackFieldKit();
|
||||
}
|
||||
|
||||
QgsFieldKitRegistry::~QgsFieldKitRegistry()
|
||||
{
|
||||
qDeleteAll( mFieldKits );
|
||||
delete mFallbackFieldKit;
|
||||
}
|
||||
|
||||
void QgsFieldKitRegistry::addFieldKit( QgsFieldKit* kit )
|
||||
{
|
||||
mFieldKits.insert( kit->id(), kit );
|
||||
emit fieldKitAdded( kit );
|
||||
}
|
||||
|
||||
void QgsFieldKitRegistry::removeFieldKit( QgsFieldKit* kit )
|
||||
{
|
||||
if ( mFieldKits.remove( kit->id() ) )
|
||||
{
|
||||
emit fieldKitRemoved( kit );
|
||||
delete kit;
|
||||
}
|
||||
}
|
||||
|
||||
QgsFieldKit* QgsFieldKitRegistry::fieldKit( const QString& id ) const
|
||||
{
|
||||
return mFieldKits.value( id, mFallbackFieldKit );
|
||||
}
|
@ -791,7 +791,7 @@ INCLUDE_DIRECTORIES(
|
||||
../core
|
||||
../core/auth
|
||||
../core/composer
|
||||
../core/fieldkit
|
||||
../core/fieldformatter
|
||||
../core/geometry
|
||||
../core/layertree
|
||||
../core/raster
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "qgsfeatureiterator.h"
|
||||
#include "qgsconditionalstyle.h"
|
||||
#include "qgsfields.h"
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsmaplayeractionregistry.h"
|
||||
@ -32,7 +32,7 @@
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsvectordataprovider.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldformatterregistry.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
@ -217,7 +217,7 @@ void QgsAttributeTableModel::featureAdded( QgsFeatureId fid )
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsFieldKit* fieldKit = mFieldKits.at( mSortFieldIndex );
|
||||
QgsFieldFormatter* fieldKit = mFieldFormatters.at( mSortFieldIndex );
|
||||
const QVariant& widgetCache = mAttributeWidgetCaches.at( mSortFieldIndex );
|
||||
const QVariantMap& widgetConfig = mWidgetConfigs.at( mSortFieldIndex );
|
||||
QVariant sortValue = fieldKit->representValue( layer(), mSortFieldIndex, widgetConfig, widgetCache, mFeat.attribute( mSortFieldIndex ) );
|
||||
@ -264,7 +264,7 @@ void QgsAttributeTableModel::layerDeleted()
|
||||
mAttributes.clear();
|
||||
mWidgetFactories.clear();
|
||||
mWidgetConfigs.clear();
|
||||
mFieldKits.clear();
|
||||
mFieldFormatters.clear();
|
||||
}
|
||||
|
||||
void QgsAttributeTableModel::attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value )
|
||||
@ -281,7 +281,7 @@ void QgsAttributeTableModel::attributeValueChanged( QgsFeatureId fid, int idx, c
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsFieldKit* fieldKit = mFieldKits.at( mSortFieldIndex );
|
||||
QgsFieldFormatter* fieldKit = mFieldFormatters.at( mSortFieldIndex );
|
||||
const QVariant& widgetCache = mAttributeWidgetCaches.at( mSortFieldIndex );
|
||||
const QVariantMap& widgetConfig = mWidgetConfigs.at( mSortFieldIndex );
|
||||
QVariant sortValue = fieldKit->representValue( layer(), mSortFieldIndex, widgetConfig, widgetCache, value );
|
||||
@ -343,14 +343,14 @@ void QgsAttributeTableModel::loadAttributes()
|
||||
{
|
||||
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( layer(), fields[idx].name() );
|
||||
QgsEditorWidgetFactory* widgetFactory = QgsEditorWidgetRegistry::instance()->factory( setup.type() );
|
||||
QgsFieldKit* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
QgsFieldFormatter* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
|
||||
if ( widgetFactory )
|
||||
{
|
||||
mWidgetFactories.append( widgetFactory );
|
||||
mWidgetConfigs.append( setup.config() );
|
||||
mAttributeWidgetCaches.append( fieldKit->createCache( layer(), idx, setup.config() ) );
|
||||
mFieldKits.append( fieldKit );
|
||||
mFieldFormatters.append( fieldKit );
|
||||
|
||||
attributes << idx;
|
||||
}
|
||||
@ -613,7 +613,7 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
|
||||
|
||||
if ( role == Qt::TextAlignmentRole )
|
||||
{
|
||||
return mFieldKits.at( index.column() )->alignmentFlag( layer(), fieldId, mWidgetConfigs.at( index.column() ) );
|
||||
return mFieldFormatters.at( index.column() )->alignmentFlag( layer(), fieldId, mWidgetConfigs.at( index.column() ) );
|
||||
}
|
||||
|
||||
if ( mFeat.id() != rowId || !mFeat.isValid() )
|
||||
@ -630,7 +630,7 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
|
||||
switch ( role )
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
return mFieldKits.at( index.column() )->representValue( layer(), fieldId, mWidgetConfigs.at( index.column() ),
|
||||
return mFieldFormatters.at( index.column() )->representValue( layer(), fieldId, mWidgetConfigs.at( index.column() ),
|
||||
mAttributeWidgetCaches.at( index.column() ), val );
|
||||
|
||||
case Qt::EditRole:
|
||||
@ -786,7 +786,7 @@ void QgsAttributeTableModel::prefetchSortData( const QString& expressionString )
|
||||
mSortFieldIndex = -1;
|
||||
mSortCacheExpression = QgsExpression( expressionString );
|
||||
|
||||
QgsFieldKit* fieldKit = nullptr;
|
||||
QgsFieldFormatter* fieldKit = nullptr;
|
||||
QVariant widgetCache;
|
||||
QVariantMap widgetConfig;
|
||||
|
||||
@ -811,7 +811,7 @@ void QgsAttributeTableModel::prefetchSortData( const QString& expressionString )
|
||||
|
||||
widgetCache = mAttributeWidgetCaches.at( mSortFieldIndex );
|
||||
widgetConfig = mWidgetConfigs.at( mSortFieldIndex );
|
||||
fieldKit = mFieldKits.at( mSortFieldIndex );
|
||||
fieldKit = mFieldFormatters.at( mSortFieldIndex );
|
||||
}
|
||||
|
||||
QgsFeatureRequest request = QgsFeatureRequest( mFeatureRequest )
|
||||
|
@ -32,7 +32,7 @@
|
||||
class QgsMapCanvas;
|
||||
class QgsMapLayerAction;
|
||||
class QgsEditorWidgetFactory;
|
||||
class QgsFieldKit;
|
||||
class QgsFieldFormatter;
|
||||
|
||||
/** \ingroup gui
|
||||
* A model backed by a {@link QgsVectorLayerCache} which is able to provide
|
||||
@ -329,7 +329,7 @@ class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel
|
||||
|
||||
QgsAttributeList mAttributes;
|
||||
QVector<QgsEditorWidgetFactory*> mWidgetFactories;
|
||||
QVector<QgsFieldKit*> mFieldKits;
|
||||
QVector<QgsFieldFormatter*> mFieldFormatters;
|
||||
QVector<QVariant> mAttributeWidgetCaches;
|
||||
QVector<QVariantMap> mWidgetConfigs;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "qgsdatetimeeditconfig.h"
|
||||
#include "qgsdatetimeeditfactory.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsdatetimefieldkit.h"
|
||||
#include "qgsdatetimefieldformatter.h"
|
||||
|
||||
QgsDateTimeEditConfig::QgsDateTimeEditConfig( QgsVectorLayer* vl, int fieldIdx, QWidget* parent )
|
||||
: QgsEditorConfigWidget( vl, fieldIdx, parent )
|
||||
@ -123,7 +123,7 @@ QVariantMap QgsDateTimeEditConfig::config()
|
||||
void QgsDateTimeEditConfig::setConfig( const QVariantMap &config )
|
||||
{
|
||||
const QgsField fieldDef = layer()->fields().at( field() );
|
||||
const QString fieldFormat = config.value( QStringLiteral( "field_format" ), QgsDateTimeFieldKit::defaultFormat( fieldDef.type() ) ).toString();
|
||||
const QString fieldFormat = config.value( QStringLiteral( "field_format" ), QgsDateTimeFieldFormatter::defaultFormat( fieldDef.type() ) ).toString();
|
||||
mFieldFormatEdit->setText( fieldFormat );
|
||||
|
||||
if ( fieldFormat == QGSDATETIMEFIELDKIT_DATEFORMAT )
|
||||
@ -135,7 +135,7 @@ void QgsDateTimeEditConfig::setConfig( const QVariantMap &config )
|
||||
else
|
||||
mFieldFormatComboBox->setCurrentIndex( 3 );
|
||||
|
||||
QString displayFormat = config.value( QStringLiteral( "display_format" ), QgsDateTimeFieldKit::defaultFormat( fieldDef.type() ) ).toString();
|
||||
QString displayFormat = config.value( QStringLiteral( "display_format" ), QgsDateTimeFieldFormatter::defaultFormat( fieldDef.type() ) ).toString();
|
||||
mDisplayFormatEdit->setText( displayFormat );
|
||||
if ( displayFormat == mFieldFormatEdit->text() )
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "qgslogger.h"
|
||||
#include "qgsdatetimeedit.h"
|
||||
#include "qgsdatetimeeditconfig.h"
|
||||
#include "qgsdatetimefieldkit.h"
|
||||
#include "qgsdatetimefieldformatter.h"
|
||||
|
||||
#include <QDateTimeEdit>
|
||||
#include <QDateEdit>
|
||||
@ -64,7 +64,7 @@ void QgsDateTimeEditWrapper::initWidget( QWidget *editor )
|
||||
return;
|
||||
}
|
||||
|
||||
const QString displayFormat = config( QStringLiteral( "display_format" ), QgsDateTimeFieldKit::defaultFormat( field().type() ) ).toString();
|
||||
const QString displayFormat = config( QStringLiteral( "display_format" ), QgsDateTimeFieldFormatter::defaultFormat( field().type() ) ).toString();
|
||||
mQDateTimeEdit->setDisplayFormat( displayFormat );
|
||||
|
||||
const bool calendar = config( QStringLiteral( "calendar_popup" ), false ).toBool();
|
||||
@ -112,7 +112,7 @@ void QgsDateTimeEditWrapper::showIndeterminateState()
|
||||
|
||||
void QgsDateTimeEditWrapper::dateTimeChanged( const QDateTime& dateTime )
|
||||
{
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldKit::defaultFormat( field().type() ) ).toString();
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldFormatter::defaultFormat( field().type() ) ).toString();
|
||||
emit valueChanged( dateTime.toString( fieldFormat ) );
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ QVariant QgsDateTimeEditWrapper::value() const
|
||||
}
|
||||
}
|
||||
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldKit::defaultFormat( field().type() ) ).toString();
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldFormatter::defaultFormat( field().type() ) ).toString();
|
||||
|
||||
if ( mQgsDateTimeEdit )
|
||||
{
|
||||
@ -150,7 +150,7 @@ void QgsDateTimeEditWrapper::setValue( const QVariant &value )
|
||||
if ( !mQDateTimeEdit )
|
||||
return;
|
||||
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldKit::defaultFormat( field().type() ) ).toString();
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldFormatter::defaultFormat( field().type() ) ).toString();
|
||||
const QDateTime date = field().type() == QVariant::DateTime ? value.toDateTime() : QDateTime::fromString( value.toString(), fieldFormat );
|
||||
|
||||
if ( mQgsDateTimeEdit )
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "qgsdatetimeedit.h"
|
||||
#include "qcalendarwidget.h"
|
||||
#include "qgsdatetimeeditconfig.h"
|
||||
#include "qgsdatetimefieldkit.h"
|
||||
#include "qgsdatetimefieldformatter.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
@ -47,7 +47,7 @@ QVariant QgsDateTimeSearchWidgetWrapper::value() const
|
||||
if ( ! mDateTimeEdit )
|
||||
return QDateTime();
|
||||
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldKit::defaultFormat( layer()->fields().at( mFieldIdx ).type() ) ).toString();
|
||||
const QString fieldFormat = config( QStringLiteral( "field_format" ), QgsDateTimeFieldFormatter::defaultFormat( layer()->fields().at( mFieldIdx ).type() ) ).toString();
|
||||
return mDateTimeEdit->dateTime().toString( fieldFormat );
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ void QgsDateTimeSearchWidgetWrapper::initWidget( QWidget* editor )
|
||||
{
|
||||
mDateTimeEdit->setAllowNull( false );
|
||||
|
||||
const QString displayFormat = config( QStringLiteral( "display_format" ), QgsDateTimeFieldKit::defaultFormat( layer()->fields().at( mFieldIdx ).type() ) ).toString();
|
||||
const QString displayFormat = config( QStringLiteral( "display_format" ), QgsDateTimeFieldFormatter::defaultFormat( layer()->fields().at( mFieldIdx ).type() ) ).toString();
|
||||
mDateTimeEdit->setDisplayFormat( displayFormat );
|
||||
|
||||
const bool calendar = config( QStringLiteral( "calendar_popup" ), false ).toBool();
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "qgsvaluemapconfigdlg.h"
|
||||
|
||||
#include "qgsattributetypeloaddialog.h"
|
||||
#include "qgsvaluemapfieldkit.h"
|
||||
#include "qgsvaluemapfieldformatter.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "qgsvaluemapsearchwidgetwrapper.h"
|
||||
#include "qgstexteditconfigdlg.h"
|
||||
#include "qgsvaluemapconfigdlg.h"
|
||||
#include "qgsvaluemapfieldkit.h"
|
||||
#include "qgsvaluemapfieldformatter.h"
|
||||
|
||||
#include "qgsfields.h"
|
||||
#include "qgsfieldvalidator.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "qgsvaluemapwidgetwrapper.h"
|
||||
#include "qgsvaluemapconfigdlg.h"
|
||||
#include "qgsvaluemapfieldkit.h"
|
||||
#include "qgsvaluemapfieldformatter.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
|
@ -76,7 +76,7 @@ QVariant QgsValueRelationSearchWidgetWrapper::value() const
|
||||
|
||||
if ( mLineEdit )
|
||||
{
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& i , mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& i , mCache )
|
||||
{
|
||||
if ( i.value == mLineEdit->text() )
|
||||
{
|
||||
@ -235,7 +235,7 @@ QWidget* QgsValueRelationSearchWidgetWrapper::createWidget( QWidget* parent )
|
||||
|
||||
void QgsValueRelationSearchWidgetWrapper::initWidget( QWidget* editor )
|
||||
{
|
||||
mCache = QgsValueRelationFieldKit::createCache( config() );
|
||||
mCache = QgsValueRelationFieldFormatter::createCache( config() );
|
||||
|
||||
mComboBox = qobject_cast<QComboBox*>( editor );
|
||||
mListWidget = qobject_cast<QListWidget*>( editor );
|
||||
@ -249,7 +249,7 @@ void QgsValueRelationSearchWidgetWrapper::initWidget( QWidget* editor )
|
||||
mComboBox->addItem( tr( "(no selection)" ), QVariant( layer()->fields().at( mFieldIdx ).type() ) );
|
||||
}
|
||||
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& element, mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& element, mCache )
|
||||
{
|
||||
mComboBox->addItem( element.value, element.key );
|
||||
}
|
||||
@ -258,7 +258,7 @@ void QgsValueRelationSearchWidgetWrapper::initWidget( QWidget* editor )
|
||||
}
|
||||
else if ( mListWidget )
|
||||
{
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& element, mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& element, mCache )
|
||||
{
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem( element.value );
|
||||
@ -272,7 +272,7 @@ void QgsValueRelationSearchWidgetWrapper::initWidget( QWidget* editor )
|
||||
{
|
||||
QStringList values;
|
||||
values.reserve( mCache.size() );
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& i, mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& i, mCache )
|
||||
{
|
||||
values << i.value;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define QGSVALUERELATIONSEARCHWIDGETWRAPPER_H
|
||||
|
||||
#include "qgssearchwidgetwrapper.h"
|
||||
#include "qgsvaluerelationfieldkit.h"
|
||||
#include "qgsvaluerelationfieldformatter.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QListWidget>
|
||||
@ -63,7 +63,7 @@ class GUI_EXPORT QgsValueRelationSearchWidgetWrapper : public QgsSearchWidgetWra
|
||||
QListWidget* mListWidget;
|
||||
QLineEdit* mLineEdit;
|
||||
|
||||
QgsValueRelationFieldKit::ValueRelationCache mCache;
|
||||
QgsValueRelationFieldFormatter::ValueRelationCache mCache;
|
||||
QgsVectorLayer* mLayer;
|
||||
|
||||
friend class QgsValueRelationWidgetFactory;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsfilterlineedit.h"
|
||||
#include "qgsfeatureiterator.h"
|
||||
#include "qgsvaluerelationfieldkit.h"
|
||||
#include "qgsvaluerelationfieldformatter.h"
|
||||
|
||||
#include <QStringListModel>
|
||||
#include <QCompleter>
|
||||
@ -65,7 +65,7 @@ QVariant QgsValueRelationWidgetWrapper::value() const
|
||||
|
||||
if ( mLineEdit )
|
||||
{
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& item , mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& item , mCache )
|
||||
{
|
||||
if ( item.value == mLineEdit->text() )
|
||||
{
|
||||
@ -95,7 +95,7 @@ QWidget* QgsValueRelationWidgetWrapper::createWidget( QWidget* parent )
|
||||
|
||||
void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor )
|
||||
{
|
||||
mCache = QgsValueRelationFieldKit::createCache( config() );
|
||||
mCache = QgsValueRelationFieldFormatter::createCache( config() );
|
||||
|
||||
mComboBox = qobject_cast<QComboBox*>( editor );
|
||||
mListWidget = qobject_cast<QListWidget*>( editor );
|
||||
@ -108,7 +108,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor )
|
||||
mComboBox->addItem( tr( "(no selection)" ), QVariant( field().type() ) );
|
||||
}
|
||||
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& element, mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& element, mCache )
|
||||
{
|
||||
mComboBox->addItem( element.value, element.key );
|
||||
}
|
||||
@ -117,7 +117,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor )
|
||||
}
|
||||
else if ( mListWidget )
|
||||
{
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& element, mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& element, mCache )
|
||||
{
|
||||
QListWidgetItem *item;
|
||||
item = new QListWidgetItem( element.value );
|
||||
@ -131,7 +131,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor )
|
||||
{
|
||||
QStringList values;
|
||||
values.reserve( mCache.size() );
|
||||
Q_FOREACH ( const QgsValueRelationFieldKit::ValueRelationItem& i, mCache )
|
||||
Q_FOREACH ( const QgsValueRelationFieldFormatter::ValueRelationItem& i, mCache )
|
||||
{
|
||||
values << i.value;
|
||||
}
|
||||
@ -166,7 +166,7 @@ void QgsValueRelationWidgetWrapper::setValue( const QVariant& value )
|
||||
}
|
||||
else if ( mLineEdit )
|
||||
{
|
||||
Q_FOREACH ( QgsValueRelationFieldKit::ValueRelationItem i, mCache )
|
||||
Q_FOREACH ( QgsValueRelationFieldFormatter::ValueRelationItem i, mCache )
|
||||
{
|
||||
if ( i.key == value )
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define QGSVALUERELATIONWIDGETWRAPPER_H
|
||||
|
||||
#include "qgseditorwidgetwrapper.h"
|
||||
#include "qgsvaluerelationfieldkit.h"
|
||||
#include "qgsvaluerelationfieldformatter.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QListWidget>
|
||||
@ -69,7 +69,7 @@ class GUI_EXPORT QgsValueRelationWidgetWrapper : public QgsEditorWidgetWrapper
|
||||
QListWidget* mListWidget;
|
||||
QLineEdit* mLineEdit;
|
||||
|
||||
QgsValueRelationFieldKit::ValueRelationCache mCache;
|
||||
QgsValueRelationFieldFormatter::ValueRelationCache mCache;
|
||||
QgsVectorLayer* mLayer;
|
||||
|
||||
friend class QgsValueRelationWidgetFactory;
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "qgscsexception.h"
|
||||
#include "qgsdxfexport.h"
|
||||
#include "qgsfields.h"
|
||||
#include "qgsfieldkit.h"
|
||||
#include "qgsfieldkitregistry.h"
|
||||
#include "qgsfieldformatter.h"
|
||||
#include "qgsfieldformatterregistry.h"
|
||||
#include "qgsfeatureiterator.h"
|
||||
#include "qgsgeometry.h"
|
||||
#include "qgslayertree.h"
|
||||
@ -3383,7 +3383,7 @@ QDomElement QgsWmsServer::createFeatureGML(
|
||||
QString QgsWmsServer::replaceValueMapAndRelation( QgsVectorLayer* vl, int idx, const QString& attributeVal )
|
||||
{
|
||||
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( vl, vl->fields().field( idx ).name() );
|
||||
QgsFieldKit* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
QgsFieldFormatter* fieldKit = QgsApplication::fieldKitRegistry()->fieldKit( setup.type() );
|
||||
QString value( fieldKit->representValue( vl, idx, setup.config(), QVariant(), attributeVal ) );
|
||||
|
||||
if ( setup.config().value( QStringLiteral( "AllowMulti" ) ).toBool() && value.startsWith( QLatin1String( "{" ) ) && value.endsWith( QLatin1String( "}" ) ) )
|
||||
|
@ -45,7 +45,7 @@ ADD_PYTHON_TEST(PyQgsEditWidgets test_qgseditwidgets.py)
|
||||
ADD_PYTHON_TEST(PyQgsExpression test_qgsexpression.py)
|
||||
ADD_PYTHON_TEST(PyQgsExpressionLineEdit test_qgsexpressionlineedit.py)
|
||||
ADD_PYTHON_TEST(PyQgsFeature test_qgsfeature.py)
|
||||
ADD_PYTHON_TEST(PyQgsFieldKitsTest test_qgsfieldkits.py)
|
||||
ADD_PYTHON_TEST(PyQgsFieldFormattersTest test_qgsfieldformatters.py)
|
||||
ADD_PYTHON_TEST(PyQgsProject test_qgsproject.py)
|
||||
ADD_PYTHON_TEST(PyQgsFeatureIterator test_qgsfeatureiterator.py)
|
||||
ADD_PYTHON_TEST(PyQgsField test_qgsfield.py)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""QGIS Unit tests for field kits.
|
||||
"""QGIS Unit tests for field formatters.
|
||||
|
||||
.. note:: 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
|
||||
@ -16,8 +16,8 @@ import qgis # NOQA
|
||||
|
||||
from qgis.core import (QgsMapLayerRegistry, QgsFeature, QgsGeometry, QgsPoint,
|
||||
QgsProject, QgsRelation, QgsVectorLayer, NULL, QgsField,
|
||||
QgsValueMapFieldKit, QgsValueRelationFieldKit,
|
||||
QgsRelationReferenceFieldKit)
|
||||
QgsValueMapFieldFormatter, QgsValueRelationFieldFormatter,
|
||||
QgsRelationReferenceFieldFormatter)
|
||||
|
||||
from qgis.testing import start_app, unittest
|
||||
from qgis.PyQt.QtCore import QVariant
|
||||
@ -26,7 +26,7 @@ from qgis.PyQt.QtWidgets import QTextEdit
|
||||
start_app()
|
||||
|
||||
|
||||
class TestQgsValueMapFieldKit(unittest.TestCase):
|
||||
class TestQgsValueMapFieldFormatter(unittest.TestCase):
|
||||
|
||||
VALUEMAP_NULL_TEXT = "{2839923C-8B7D-419E-B84B-CA2FE9B80EC7}"
|
||||
|
||||
@ -38,7 +38,7 @@ class TestQgsValueMapFieldKit(unittest.TestCase):
|
||||
f = QgsFeature()
|
||||
f.setAttributes([2, 2.5, 'NULL', None, None, None])
|
||||
layer.dataProvider().addFeatures([f])
|
||||
fieldKit = QgsValueMapFieldKit()
|
||||
fieldKit = QgsValueMapFieldFormatter()
|
||||
|
||||
# Tests with different value types occurring in the value map
|
||||
config = {'map': {'two': '2', 'twoandhalf': '2.5', 'NULL text': 'NULL',
|
||||
@ -63,7 +63,7 @@ class TestQgsValueMapFieldKit(unittest.TestCase):
|
||||
QgsMapLayerRegistry.instance().removeAllMapLayers()
|
||||
|
||||
|
||||
class TestQgsValueRelationFieldKit(unittest.TestCase):
|
||||
class TestQgsValueRelationFieldFormatter(unittest.TestCase):
|
||||
|
||||
def test_representValue(self):
|
||||
|
||||
@ -81,7 +81,7 @@ class TestQgsValueRelationFieldKit(unittest.TestCase):
|
||||
f.setAttributes([123, 'decoded_val'])
|
||||
second_layer.dataProvider().addFeatures([f])
|
||||
|
||||
fieldKit = QgsValueRelationFieldKit()
|
||||
fieldKit = QgsValueRelationFieldFormatter()
|
||||
|
||||
# Everything valid
|
||||
config = {'Layer': second_layer.id(), 'Key': 'pkid', 'Value': 'decoded'}
|
||||
@ -110,7 +110,7 @@ class TestQgsValueRelationFieldKit(unittest.TestCase):
|
||||
QgsMapLayerRegistry.instance().removeMapLayer(second_layer.id())
|
||||
|
||||
|
||||
class TestQgsRelationReferenceFieldKit(unittest.TestCase):
|
||||
class TestQgsRelationReferenceFieldFormatter(unittest.TestCase):
|
||||
|
||||
def test_representValue(self):
|
||||
|
||||
@ -130,7 +130,7 @@ class TestQgsRelationReferenceFieldKit(unittest.TestCase):
|
||||
|
||||
relMgr = QgsProject.instance().relationManager()
|
||||
|
||||
fieldKit = QgsRelationReferenceFieldKit()
|
||||
fieldKit = QgsRelationReferenceFieldFormatter()
|
||||
|
||||
rel = QgsRelation()
|
||||
rel.setRelationId('rel1')
|
Loading…
x
Reference in New Issue
Block a user