Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[solved] QComboBox copy
p91paul last edited by
I've subclassed QComboBox, and I want to create a copy constructor. Is this possible? I've seen the copy constructor exist but it is private, and there is another protected that accepts a QComboBoxPrivate and a QWidget as arguments.
edit: I've seen copy constructor and operator= are declared private explicitly to avoid object copy. this makes things harder =D
EDIT: guys I love qt. I no more need help, since I want to do this to use qt designer to create comboboxes than transform then in my custom class. Then I discovered widget promotion, and I've seen the light. :D
giesbert last edited by
just as a side note: all QObjects arte copy disabled. Only the data containers (strings, containers, variant, ...) are copy enabled.
This is by design, as widgets are typically created by new, not by assignment. This is also necassary as the parent child relation ship comes also into the game.
Think of a QMainWindow with a huge UI insid (many child widgets with child widgets with ...). Copying that will be really complicated, especially as the parent only has a QWidget pointer but the cchild is a QWidget derived class...