Problem is probably stupid but so far I failed to find what I am doing wrong.
I have in my project these two classes:
Code:
{ Q_OBJECT public: protected slots: void setPrintSlot(); void setPackSlot(); void setProcessSlot(); protected: void initializePrintModel(); void initializePackModel(); void initializeProcessingModel(); int m_index; QLabel *m_jobNameLabel; QLineEdit *m_jobNameLineEdit; QLabel *m_userCountLabel; QSpinBox *m_userCountSpinBox; QLabel *m_duplexLabel; QComboBox *m_duplexComboBox; QLabel *m_resolutionLabel; QComboBox *m_resolutionComboBox; QLabel *m_deliveryLabel; QComboBox *m_deliveryComboBox; QLabel *m_shipmentLabel; QComboBox *m_shipmentComboBox; QTreeView *m_printTreeView; QStandardItemModel *m_printItemModel; QPushButton *m_printButton; QTreeView *m_packTreeView; QStandardItemModel *m_packItemModel; QPushButton *m_packButton; QTreeView *m_processingTreeView; QStandardItemModel *m_processingItemModel; QPushButton *m_processingButton; QGroupBox *m_jobGroupBox; QGridLayout *m_jobGroupBoxLayout; QSpacerItem *m_leftJobSpacerItem; QSpacerItem *m_rightJobSpacerItem; }; { Q_OBJECT public: protected: RegularHeaderLayout *m_headerLayout; QList<RegularJobLayout> *m_jobList; QVBoxLayout *m_layout; };
I had five separate RegularJobLayout pointers in my RegularCentralWidget class but decided that this is a more professional approach. Easier to update my code at later time. In the constructor I have the following code:
Code:
{ m_headerLayout = new RegularHeaderLayout(); m_layout->addLayout(m_headerLayout); int index, maxJobs = 5; QString title; m_jobList = new QList<RegularJobLayout>(); for(index = 0; index < maxJobs; ++index) { title.setNum(index+1); title.prepend("Posao "); m_jobList->append(new RegularJobLayout(title, index)); //This line fails m_layout->addLayout(m_jobList[index]); //This line fails } }
Constructor can probably be better but I am still trying to make it work. I get the following errors:
/home/ivan/Development/Qt/RadniNalog/WorkOrder0.2.3/wouil.cpp:155: error: no matching function for call to ‘QList<telekom::workorder::RegularJobLayout> ::append(telekom::workorder::RegularJobLayout*)â⠂¬â„¢
/usr/include/qt4/QtCore/qlist.h:422: note: candidates are: void QList<T>::append(const T&) [with T = telekom::workorder::RegularJobLayout]
/usr/include/qt4/QtCore/qlist.h:623: note: void QList<T>::append(const QList<T>&) [with T = telekom::workorder::RegularJobLayout]
/home/ivan/Development/Qt/RadniNalog/WorkOrder0.2.3/wouil.cpp:157: error: no matching function for call to ‘QVBoxLayout::addLayout(QList<telekom::worko rder::RegularJobLayout>&)’
/usr/include/qt4/QtGui/qboxlayout.h:86: note: candidates are: void QBoxLayout::addLayout(QLayout*, int)
If somebody would help me to figure out where am I making a mistake I would really appreciate it.
Thanks in advance.