Ok. I have a class.
{
public:
protected:
int m_count;
};
class Material : public QObject
{
public:
Material(QObject *parent = 0);
protected:
int m_count;
QString m_fisName;
QString m_fisCode;
QString m_name;
QString m_nameAux;
};
To copy to clipboard, switch view to plain text mode
I made a typedef
typedef QList<Material> MaterialList;
typedef QList<Material> MaterialList;
To copy to clipboard, switch view to plain text mode
I have another class
class RegularOrder : public Order
{
public:
void TwinList(MaterialList twinList);
void P3110List(MaterialList p3110List);
void CPSList(MaterialList cpsList);
void KernList(MaterialList kernList);
void BurhList(MaterialList burhList);
void ManualList(MaterialList manualList);
protected:
QList<Template> m_templateList;
int m_currentTemplateIndex;
UseFlag m_listFlag;
int m_listCount;
MaterialList m_twinList;
MaterialList m_p3110List;
MaterialList m_cpsList;
MaterialList m_kernList;
MaterialList m_burhList;
MaterialList m_manualList;
QList<JobProperties> m_jobPropertiesList;
};
class RegularOrder : public Order
{
public:
RegularOrder(QObject *parent = 0);
void TwinList(MaterialList twinList);
void P3110List(MaterialList p3110List);
void CPSList(MaterialList cpsList);
void KernList(MaterialList kernList);
void BurhList(MaterialList burhList);
void ManualList(MaterialList manualList);
protected:
QList<Template> m_templateList;
int m_currentTemplateIndex;
UseFlag m_listFlag;
int m_listCount;
QString m_deliveryWhole;
MaterialList m_twinList;
MaterialList m_p3110List;
MaterialList m_cpsList;
MaterialList m_kernList;
MaterialList m_burhList;
MaterialList m_manualList;
QList<JobProperties> m_jobPropertiesList;
};
To copy to clipboard, switch view to plain text mode
which is so far implemented like this
RegularOrder
::RegularOrder(QObject *parent
) : Order
(parent
) {
}
void RegularOrder::TwinList(MaterialList twinList)
{
m_twinList = twinList;
}
void RegularOrder::P3110List(MaterialList p3110List)
{
m_p3110List = p3110List;
}
void RegularOrder::CPSList(MaterialList cpsList)
{
m_cpsList = cpsList;
}
void RegularOrder::KernList(MaterialList kernList)
{
m_kernList = kernList;
}
void RegularOrder::BurhList(MaterialList burhList)
{
m_burhList = burhList;
}
void RegularOrder::ManualList(MaterialList manualList)
{
m_manualList = manualList;
}
RegularOrder::RegularOrder(QObject *parent) : Order(parent)
{
}
void RegularOrder::TwinList(MaterialList twinList)
{
m_twinList = twinList;
}
void RegularOrder::P3110List(MaterialList p3110List)
{
m_p3110List = p3110List;
}
void RegularOrder::CPSList(MaterialList cpsList)
{
m_cpsList = cpsList;
}
void RegularOrder::KernList(MaterialList kernList)
{
m_kernList = kernList;
}
void RegularOrder::BurhList(MaterialList burhList)
{
m_burhList = burhList;
}
void RegularOrder::ManualList(MaterialList manualList)
{
m_manualList = manualList;
}
To copy to clipboard, switch view to plain text mode
When I try to compile I get the following messages:
/home/ivan/Development/Qt/Radni Nalog/WorkOrder/woidl.cpp:1: In file included from woidl.cpp:1:
/home/ivan/Development/Qt/Radni Nalog/WorkOrder/woidl.h:14: instantiated from ‘void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = Telekom::WorkOrder::Material]’
/home/ivan/Development/Qt/Radni Nalog/WorkOrder/woidl.h:14: instantiated from ‘void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = Telekom::WorkOrder::Material]’
/home/ivan/Development/Qt/Radni Nalog/WorkOrder/woidl.h:14: instantiated from ‘void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = Telekom::WorkOrder::Material]’
/home/ivan/Development/Qt/Radni Nalog/WorkOrder/woidl.h:14: instantiated from ‘void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = Telekom::WorkOrder::Material]’
/home/ivan/Development/Qt/Radni Nalog/WorkOrder/woidl.h:14: instantiated from ‘void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [with T = Telekom::WorkOrder::Material]’
Basically the compile stops at the m_twinList = twinList line of code. I read somewhere that QObject can't be used as a reference and copied as normal because of something but honestly didn't understand it completely.
I solved the problem by removing the inheritance of QObject in Material class. I made it independent. Now I only sort of needed that because I could make some other object a parent of the material class instances so I would have to worry about deleting it. My program will work just fine with out this parenting because only RegularOrder class will be instantiated and only RegularOrder class will need a parent to look after it. But could somebody explain to me what exactly happened here so I know for the future.
Thanks.
Bookmarks