- QString aCaseId = QString::fromStdString(myDefValue.empty()?
- aStringAttr->value() : myDefValue);
- myIsFirst = false;
- int idx = myCaseIds.indexOf(aCaseId);
- if (idx == -1)
- idx = currentPageIndex();
- setCurrentPageIndex(idx);
+ QString aCaseId;
+ if (aStringAttr->isInitialized()) {
+ aCaseId = QString::fromStdString(aStringAttr->value());
+ int idx = myCaseIds.indexOf(aCaseId);
+ if (idx == -1)
+ idx = currentPageIndex();
+ setCurrentPageIndex(idx);
+ if (aStringAttr->value() != aCaseId.toStdString())
+ storeValueCustom();
+ }
+ else {
+ // It is added because if user edits the feature created from Python
+ // and switches his choice
+ // it will not be stored in the attribute while apply not pressed.
+ // But this button will be disabled because of not initialized attribute
+ aStringAttr->setValue(myCaseIds.at(0).toStdString());
+ setCurrentPageIndex(0);
+ }