[Development] Why does QLabel::pixmap() return `const QPixmap*`?
kevin.kofler at chello.at
Sun Nov 30 06:37:11 CET 2014
Sze Howe Koh wrote:
> I'm curious about the rationale behind this API design. I can't think
> of any other Qt function that returns an implicitly-shared object by
> pointer, so this seems inconsistent. e.g. QWidget::font() returns a
> QFont by const-ref.
Probably because the pointer can be null. C++ does not allow null
references. (The compiler might let you get away with it, but in principle,
it is not allowed.)
More information about the Development