[solved] QComboBox copy



  • 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.
    thanks
    Paolo

    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



  • Hi Paolo,
    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...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.