[Development] Updating holdover API from Qt 1 times

Matthew Woehlke mwoehlke.floss at gmail.com
Tue Aug 20 16:29:03 CEST 2019


On 17/08/2019 00.13, Sze Howe Koh wrote:
>  QLabel returns some CoW types by-pointer as a legacy from Qt 1 times [1]:
> 
>     QPixmap *QLabel::pixmap() const;
>     QPixture *QLabel::pixmap() const;

Does this allow one to obtain the internal pixmap and modify it in-place
without then calling setPixmap? If so, note that changing these to
return by value represents a non-trivial change to the API. (Although,
perhaps that's a change we *want*...)

> 3) Pick one of the options above, but go one step further and use
> std::optional (C++17) instead of returning null objects.

Ugh... I'm with Kevin; I think this doesn't make sense and adds a level
of indirection for no good reason that will only make the API's harder
to use.

Please choose based on what produces the best API in the end, not the
least porting effort. Otherwise we are just trading one sub-optimal API
for another.

-- 
Matthew


More information about the Development mailing list