Re: [Development] unique_ptr and Qt, Take 2

2019-05-04 Thread Иван Комиссаров
That’s exactly the problem we’re discussing here. Consider this example (was writing without a compiler, might be typos) class MyWidget : public QWidget { QWidget container; // note, doesn’t require explicit parent, layout handles that QLabel label; public: Widget(QWidget *parent) : Q

Re: [Development] unique_ptr and Qt, Take 2

2019-05-04 Thread Allan Sandfeld Jensen
On Samstag, 4. Mai 2019 00:43:10 CEST Thiago Macieira wrote: > On Friday, 3 May 2019 13:00:52 PDT Иван Комиссаров wrote: > > Which should be considered bad practice and banned on an API level > > No way. > > Are you going to forbid creation of QFile on the stack? Perhaps QFile shouldn't be the s

Re: [Development] unique_ptr and Qt, Take 2

2019-05-04 Thread Daniel Teske
Иван Комиссаров: IMHO, it should be a Qt6 feature. It’s awesome. However, I liked the idea (is it deprecated or what?) of a template method template std::observer_ptr qMakeChild(gsll::not_null> parent, Args… args) {     return parent->adoptChild(std::make_unique(args)); } For some classes