Using Qt 5.4 and compiling in Qt Creator.
In widget 1, there is a file-scoped QList:
static QList< Tag * > g_Tags;
Note that Tag inherits from BaseDataObject. Both Tag and BaseDataObject have private, undefined copy constructors and operator=() functions.
Also in widget 1, there is the following constructor call:
MoverDialog dlg( g_Tags, this );
In simplified form, MoverDialog.h looks like:
class MoverDialog : public QDialog
{
Q_OBJECT
public:
///////////////////////////////////////////////////////////////////////////////////////////
// Constructors/Destructor
explicit MoverDialog( QList< BaseDataObject * > & availableList,
QWidget * parent = 0 );
virtual ~MoverDialog();
etc. etc.
When I compile this code, I get the following error:
D:\MyDocs\Projects\dsb\Src\Apps\RecipeMgr_Qt\Source\Ui\RecipeGeneralWidget.cpp:166: error: C2664:
'MoverDialog::MoverDialog(QList<T> &,QList<T> &,QWidget *)' : cannot convert parameter 1
from 'QList<T>' to 'QList<T> &'
with
[
T=recipemgr::BaseDataObject *
]
and
[
T=recipemgr::Tag *
]
and
[
T=recipemgr::BaseDataObject *
]]
Compilation succeeds if I change the declaration of the file-scoped list to:
static QList< BaseDataObject * > g_Tags;
Why does compilation fail with the file-scoped list declared using "Tag *" like shown at the top of this posting?