17#include "moc_qgsrelationreferencesearchwidgetwrapper.cpp" 
   28#include <QStringListModel> 
   53  if ( fkeys.isEmpty() )
 
   60    Q_ASSERT( fieldPairs.count() == fkeys.count() );
 
   61    for ( 
int i = 0; i < fieldPairs.count(); i++ )
 
   63      if ( fieldPairs.at( i ).referencingField() == 
layer()->fields().at( 
fieldIndex() ).name() )
 
 
   87    return fieldName + 
" IS NULL";
 
   89    return fieldName + 
" IS NOT NULL";
 
   91  const QVariant v = 
value();
 
   95  switch ( v.userType() )
 
   97    case QMetaType::Type::Int:
 
   98    case QMetaType::Type::UInt:
 
   99    case QMetaType::Type::Double:
 
  100    case QMetaType::Type::LongLong:
 
  101    case QMetaType::Type::ULongLong:
 
  106          return fieldName + 
" IS NULL";
 
  107        return fieldName + 
'=' + v.toString();
 
  112          return fieldName + 
" IS NOT NULL";
 
  113        return fieldName + 
"<>" + v.toString();
 
  121        return fieldName + 
"='" + v.toString() + 
'\'';
 
  123        return fieldName + 
"<>'" + v.toString() + 
'\'';
 
 
  143    mWidget->setEnabled( enabled );
 
 
  154  onValuesChanged( QVariantList() << 
value );
 
 
  157void QgsRelationReferenceSearchWidgetWrapper::onValuesChanged( 
const QVariantList &values )
 
  159  if ( values.isEmpty() )
 
  168    const QVariant 
value = values.at( 0 );
 
  182  if ( exp == nullValue )
 
  188    str = QStringLiteral( 
"%1 = '%3'" )
 
 
  201  mWidget = qobject_cast<QgsRelationReferenceWidget *>( editor );
 
  213  const bool fetchLimitActive = 
config( QStringLiteral( 
"FetchLimitActive" ), 
QgsSettings().
value( QStringLiteral( 
"maxEntriesRelationWidget" ), 100, 
QgsSettings::Gui ).toInt() > 0 ).toBool();
 
  214  if ( fetchLimitActive )
 
  219  if ( 
config( QStringLiteral( 
"FilterFields" ), QVariant() ).isValid() )
 
  230  mWidget->
setRelation( relation, 
config( QStringLiteral( 
"AllowNULL" ) ).toBool() );
 
 
static QString nullRepresentation()
Returns the string used to represent the value NULL throughout QGIS.
 
static QString quotedColumnRef(QString name)
Returns a quoted column reference (in double quotes)
 
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
 
Map canvas is a class for displaying all GIS data types on a canvas.
 
QgsRelationManager * relationManager
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
Q_INVOKABLE QgsRelation relation(const QString &id) const
Gets access to a relation by its id.
 
Represents a relationship between two vector layers.
 
QList< QgsRelation::FieldPair > fieldPairs() const
Returns the field pairs which form this relation The first element of each pair are the field names o...
 
Stores settings for use within QGIS.
 
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
 
Represents a vector layer which manages a vector based dataset.
 
QList< QgsRelation > referencingRelations(int idx) const
Returns the layer's relations, where the foreign key is on this layer.