Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
Qt Creator 3.1.1, Qt Creator 3.1.2, Qt Creator 3.2.0-beta1, Qt Creator 3.3.0-beta1
-
None
-
3a1f6f9ad78e53129b1fba8be8c644e9f1496e85
Description
Currently autogenerated code has the pattern:
void setStuff(Stuff arg)
{
if (m_stuff != arg) {
m_stuff = arg;
emit stuffChanged(arg);
}
}
Several people argument against this and prefer a fail-fast to avoid unnecesary nesting of brackets. So a pattern of:
void setStuff(Stuff arg) { if (m_stuff == arg) return; m_stuff = arg; emit stuffChanged(arg); }
is cleaner and avoids unnecesary bracket nesting.