D16484: Add scratchpad plugin

Aaron Puchert noreply at phabricator.kde.org
Mon Dec 10 21:03:05 GMT 2018


aaronpuchert added inline comments.

INLINE COMMENTS

> amhndu wrote in scratchpad.cpp:136
> Understood.
> Should I then push after fixing this ?

It seems that the `QStandardItemModel` pointed to by `m_model` is owned by `Scratchpad`, so I wouldn't return a non-const pointer from a const method. But why not have both?

  QStandardItemModel* model();
  const QStandardItemModel* model() const;

I'm not sure why the Qt documentation suggests that `const` “falls apart” there. It works pretty well for the STL, see e.g. std::vector::data <https://en.cppreference.com/w/cpp/container/vector/data>. The rule is not to generally not return non-const pointers/references from const functions, only when the returned pointer/reference points to something we consider a subobject. If it's a reference to something else that we don't own, the rule doesn't apply.

REPOSITORY
  R32 KDevelop

BRANCH
  scratchpad

REVISION DETAIL
  https://phabricator.kde.org/D16484

To: amhndu, #kdevelop, kfunk
Cc: aaronpuchert, kfunk, gregormi, brauch, kdevelop-devel, glebaccon, hase, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20181210/90f25512/attachment.html>


More information about the KDevelop-devel mailing list