c++ - Move assingment operator for a QWidget derivate? -
this question has answer here:
- how copy object in qt? 2 answers
i have qwidget derivate, let assume standard qwidget example
class mainwindow : public qmainwindow { //.. }
does make sense class mainwindow fullfill rule of five, mean move constructor , move assignment ?
(since mainwindow should created once)
nope. qobject derived classes should never copied , using q_disable_copy macro qobject , derived classes explicitly disable/hide copy constructor , assignment operator declaring them private. possibly has changed recent releases , c++ 11 compatible compilers might declared deleted. see here
so rule of 5 out. , looking @ qt source can't find support moving qobject derived classes ...
one final read qt objects: identity vs value
Comments
Post a Comment