Results 1 to 2 of 2

Thread: How to write copy consctructor for class inheriting from QObject .

  1. #1
    Join Date
    Mar 2009
    Location
    delhi India
    Posts
    56
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default How to write copy consctructor for class inheriting from QObject .

    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.

  2. #2
    Join Date
    Aug 2009
    Location
    Greece, Chania
    Posts
    63
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: How to write copy consctructor for class inheriting from QObject .

    1st read this 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.
    Misha R.evolution - High level Debugging IDE

    Programming is about 2 basic principles: KISS and RTFM!!!

Similar Threads

  1. Replies: 10
    Last Post: 2nd March 2011, 12:25
  2. Determine Class Type of QObject Parent
    By photo_tom in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2010, 18:42
  3. QListWidget inheriting custom class
    By phannent in forum Qt Tools
    Replies: 1
    Last Post: 4th August 2008, 15:39
  4. QObject and copy Constructors
    By December in forum Qt Programming
    Replies: 5
    Last Post: 17th July 2008, 17:14
  5. create a Class inherits from two QObject subclasses
    By sabeesh in forum Qt Programming
    Replies: 17
    Last Post: 31st December 2007, 13:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.