D16484: Add scratchpad plugin
noreply at phabricator.kde.org
Mon Dec 10 21:03:05 GMT 2018
aaronpuchert added inline comments.
> amhndu wrote in scratchpad.cpp:136
> 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?
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.
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...
More information about the KDevelop-devel