Introduce coding-conventions.md
ClosedPublic

Authored by zzag on Jan 31 2020, 11:33 AM.

Details

Summary

Hopefully, the new document makes it clear when one can use QRect::right()
and QRect::bottom().

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Jan 31 2020, 11:33 AM
Restricted Application added a project: KWin. · View Herald TranscriptJan 31 2020, 11:33 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Jan 31 2020, 11:33 AM
zzag updated this revision to Diff 74758.Jan 31 2020, 11:37 AM

Fix a copy-paste error.

zzag updated this revision to Diff 74759.Jan 31 2020, 11:39 AM

Simplify code samples.

davidedmundson accepted this revision.Feb 3 2020, 10:04 AM
davidedmundson added a subscriber: davidedmundson.

++

You know my thoughts on per project rules.
But maybe it is different for kwin. Use of setRight() is the easier call than left+width() if you are actually using it for painting and need to think about the 1px the other way round.

But would here work? https://community.kde.org/Policies/API_to_Avoid#API_that_is_considered_broken
if we added a line about "for anything other than painting"

doc/coding-conventions.md
39

please say another QRect instead of rectangle.

QRectF source;
QRect target;

target.setRight(source.right());

is problematic

This revision is now accepted and ready to land.Feb 3 2020, 10:04 AM
zzag updated this revision to Diff 74905.Feb 3 2020, 10:34 AM

rectangle -> QRect

zzag added a comment.Feb 3 2020, 10:41 AM

But would here work? https://community.kde.org/Policies/API_to_Avoid#API_that_is_considered_broken
if we added a line about "for anything other than painting"

Maybe... But I would like to avoid comments such as "i'm not a big fan of this policy, boo!" If other projects find this policy somewhat sensible, then I think we could move it "upstream."

This revision was automatically updated to reflect the committed changes.