-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix saving of the collapsed state for relations #3704
Conversation
Looks good to me |
@@ -547,6 +549,9 @@ void QgsCollapsibleGroupBox::showEvent( QShowEvent * event ) | |||
|
|||
QString QgsCollapsibleGroupBox::saveKey() const | |||
{ | |||
if ( objectName().isEmpty() || ( mSettingGroup.isEmpty() && window()->objectName().isEmpty() ) ) | |||
return QString::null; // cannot get a valid key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be a null string or would QString() be ok? Qt docs recommend against using QString::isNull.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care. Switched to empty string to make you happy ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, @nyalldawson, for your information, QString()
builds a null string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why the qt docs recommend not using it - it's confusing. QString() builds an empty but non null string, but a null QString is an empty string....!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/qt/qtbase/blob/dev/tests/auto/corelib/tools/qstring/tst_qstring.cpp#L1118-L1123
QString nullStr;
QVERIFY( nullStr.isNull() );
QVERIFY( nullStr.isEmpty() );
QString empty("");
QVERIFY( !empty.isNull() );
QVERIFY( empty.isEmpty() );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops... Ignore me, just getting confused! Anyway, qt docs still say QString::null is evil ;)
In the attribute form, the collapsed state of RelationReference was not loaded correctly and was interfering with the collapsed state of the relation editor. Plus, the state was saved globally for a reference. Meaning that if a reference was used (through other references) from other layers, it was sharing the same state.
e5520ea
to
28457ed
Compare
@nyalldawson I think this should be ready to merge? |
In the attribute form, the collapsed state of RelationReference
was not loaded correctly and was interfering with the collapsed
state of the relation editor.
Plus, the state was saved globally for a reference. Meaning that
if a reference was used (through other references) from other
layers, it was sharing the same state.