'Call to implicitly-deleted copy constructor' when attempting to implement class inheritance



  • Hi,

    I have a generic Worksheet class, and am trying to create a new inherited class called LocalWorksheet. Here is the stripped out source code that I am using.

    localworksheet.h:

    #include <worksheet.h>
    class LocalWorksheet : public Worksheet
    {
        Q_OBJECT
    public:
        LocalWorksheet(const QString &title);
    };
    

    localworksheet.cpp:

    #include "localworksheet.h"
    LocalWorksheet::LocalWorksheet(const QString &title) : Worksheet(title)
    {
    }
    

    The error I'm getting is this:

        LocalWorksheet w = LocalWorksheet(title);
                       ^   ~~~~~~~~~~~~~~~~~~~~~
    

    What am I doing wrong?


  • Lifetime Qt Champion

    Hi,

    QObject is a non copyable type. See here for more information.


Log in to reply
 

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