Value relation rework & more small updates#4525
Conversation
…completer and null values
📦 Build Artifacts Ready
|
📦 Build Artifacts Ready
|
| fontColor: __style.darkGreyColor | ||
| fontColorHover: __style.nightColor |
There was a problem hiding this comment.
shouldn't the text be red?
| fontColor: __style.darkGreyColor | ||
| fontColorHover: __style.nightColor |
There was a problem hiding this comment.
shouldn't the text be red?
| for ( let i = 0; i < formsStack.depth; i++ ) { | ||
| let form = formsStack.get( i ) | ||
| form.featureLayerPair = __inputUtils.createFeatureLayerPair() | ||
| form.featureLayerPair = __inputUtils.createFeatureLayerPair |
There was a problem hiding this comment.
We are passing reference to the function here, that doesn't seem right
| return; | ||
| } | ||
|
|
||
| CoreUtils::log( u"Sync Manager"_s, u"Requested download of project %2"_s.arg( project.mergin.projectName ) ); |
There was a problem hiding this comment.
| CoreUtils::log( u"Sync Manager"_s, u"Requested download of project %2"_s.arg( project.mergin.projectName ) ); | |
| CoreUtils::log( QStringLiteral( "Sync Manager" ), QStringLiteral( "Requested download of project %2" ).arg( project.mergin.projectName ) ); |
| return; | ||
| } | ||
|
|
||
| CoreUtils::log( u"Sync Manager"_s, u"Requested %1 sync of project %2"_s.arg( requestOrigin == SyncOptions::ManualRequest ? "manual" : "automatic" ).arg( project.projectName ) ); |
| } | ||
| } | ||
|
|
||
| return QStringList() << qgsValue.toString(); |
There was a problem hiding this comment.
| return QStringList() << qgsValue.toString(); | |
| return { qgsValue.toString() }; |
| if ( keyFieldDef.isNumeric() ) | ||
| { | ||
| bool ok = false; | ||
| const qlonglong numVal = k.toLongLong( &ok ); | ||
| if ( ok ) | ||
| { | ||
| typedKey = QVariant( numVal ); | ||
| } | ||
| } | ||
| quotedKeys << QgsExpression::quotedValue( typedKey ); |
There was a problem hiding this comment.
So we convert string -> number -> string?
| /** | ||
| * Parses a QGIS value-relation wire value into a list of key strings. | ||
| * allowMulti=true → "{1,2,3}" becomes ["1","2","3"] | ||
| * allowMulti=false → "1" becomes ["1"] | ||
| * An empty or null input always returns an empty list. | ||
| */ | ||
| Q_INVOKABLE QStringList qgisFormatToArray( const QVariant &qgsValue ) const; | ||
|
|
||
| /** | ||
| * Formats a list of key strings into the QGIS wire value "{k1,k2,...}". | ||
| * allowMulti=true → "["1","2","3"]" becomes ["1","2","3"] | ||
| * allowMulti=true → "["1"]" becomes "1" | ||
| * allowMulti=false → "1" becomes "1" | ||
| * An empty list produces "". | ||
| */ | ||
| Q_INVOKABLE QString arrayToQgisFormat( const QStringList &keys ) const; |
There was a problem hiding this comment.
I still think these should be just static utility functions, not tied to the class
| qmlRegisterType< ValueRelationFeaturesModel >( "mm", 1, 0, "ValueRelationFeaturesModel" ); | ||
| qmlRegisterType< ValueRelationController >( "mm", 1, 0, "ValueRelationController" ); |
There was a problem hiding this comment.
| qmlRegisterType< ValueRelationFeaturesModel >( "mm", 1, 0, "ValueRelationFeaturesModel" ); | |
| qmlRegisterType< ValueRelationController >( "mm", 1, 0, "ValueRelationController" ); |
Let's do it the declarative way, by using QML_ELEMENT
| #include "qgsexpressioncontextutils.h" | ||
| #include "qgsvectorlayer.h" | ||
|
|
||
| using namespace Qt::Literals; |
Coverage Report for CI Build 27562718106Warning No base build found for commit Coverage: 57.561%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
📦 Build Artifacts Ready
|
Introduces a new way of handling value relation editors. Improves performance and stability.
Changes:
ValueRelationControllerthat performs lookups fromkeytovalue, handles hot reload (filter expression) and conversions from/to QGIS format, e. g."{1,2,3}"to[1,2,3]Todos:
distance(@geometry, @current_geometry) <= 0.000135Other updates:
MMDrawerHeaderandMMListMultiselectDrawermultiselect drawer to make their API easier to useResolves #4255
Resolves #4497
Resolves #4443
Resolves #3297
Resolves #3737
Resolves #4508
Resolves #4505
Resolves #2148 (<- the only limitation is VR fields with filter expression)
Resolves (? needs to be tested) #4504