PDA

View Full Version : How to write copy consctructor for class inheriting from QObject .



vaibhav
7th March 2011, 09:37
Hi,
I have a class templete like this

class button: public QObject,public ...//other inheriting classes.
{
public:

//copy constructor.
button(const button &b):size(b.size),QObject(0),push(0):
{

}
private:
QPushButton *push;
int size;
}


When i create the clone for this class my copy constructor is called some how my signal slot mechanism is not working for this copy constructor.

Any help would be appreciated.

Archimedes
7th March 2011, 14:02
1st read this (http://doc.qt.nokia.com/4.6/object.html) on why copy is meaningless.
What you are trying to do? You have the QPushButton initialized to 0 so it hasn't any signal/slots connected.