Problem mit QList<QCheckBox>
-
Hallo alle miteinander,
ich habe derzeit ein ziemlich merkwürdiges Problem:
Ich habe eine QList<QCheckBox>. Dieser Liste werden QCheckBox's hinzugefügt, und diese Elemente werden anschließend in ein Layout gepackt:QList<QCheckBox>:
QList<QCheckBox> *modulChecks;
modulChecks = new QList<QCheckBox>();
So, hier die Zuweisung:
for(int i=0;i<modulList->size();i++) { QCheckBox *tmpBox = new QCheckBox(modulList->at(i)); modulChecks->append(*tmpBox); modulLayout->addWidget(modulChecks->at(i),i,0); }
So weit, so gut. Wenn ich jetzt aber compiliere erhalte ich haarsträubende Fehlermeldungen:
mingw32-make -f Makefile.Release mingw32-make[1]: Entering directory `J:/Progging/C++/OES/Server' g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_D LL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.0.0/include/QtGui" -I"C:/Qt/4.0.0/include/QtCore" -I"C:/Qt/4.0.0/inc lude" -I"." -I"C:/Qt/4.0.0/include/ActiveQt" -I"release" -I"." -I"C:\Qt\4.0.0\mk specs\win32-g++" -o release\oeueditor.o oeueditor.cpp oeueditor.cpp: In member function `int OEditor::getModules()': oeueditor.cpp:338: error: no matching function for call to `QGridLayout::addWidg et(const QCheckBox&, int&, int)' C:/Qt/4.0.0/include/QtGui/../../src/gui/kernel/qgridlayout.h:84: note: candidate s are: void QGridLayout::addWidget(QWidget*) C:/Qt/4.0.0/include/QtGui/../../src/gui/kernel/qgridlayout.h:85: note: void QGridLayout::addWidget(QWidget*, int, int, Qt::Alignment) C:/Qt/4.0.0/include/QtGui/../../src/gui/kernel/qgridlayout.h:86: note: void QGridLayout::addWidget(QWidget*, int, int, int, int, Qt::Alignment) C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h: In member function `void QList<T>::append(const T&) [with T = QCheckBox]': oeueditor.cpp:336: instantiated from here C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h:80: error: `QCheckBo x::QCheckBox(const QCheckBox&)' is private C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:390: error: within th is context C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h: In member function `void QList<T>::node_construct(QList<T>::Node*, const T&) [with T = QCheckBox]': C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:388: instantiated f rom `void QList<T>::append(const T&) [with T = QCheckBox]' oeueditor.cpp:336: instantiated from here C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h:80: error: `QCheckBo x::QCheckBox(const QCheckBox&)' is private C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:301: error: within th is context C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h:80: error: `QCheckBo x::QCheckBox(const QCheckBox&)' is private C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:302: error: within th is context C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h:80: error: `QCheckBo x& QCheckBox::operator=(const QCheckBox&)' is private C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:303: error: within th is context C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h: In member function `void QList<T>::node_copy(QList<T>::Node*, QList<T>::Node*, QList<T>::Node*) [wi th T = QCheckBox]': C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:488: instantiated f rom `void QList<T>::detach_helper() [with T = QCheckBox]' C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:92: instantiated fr om `void QList<T>::detach() [with T = QCheckBox]' C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:386: instantiated f rom `void QList<T>::append(const T&) [with T = QCheckBox]' oeueditor.cpp:336: instantiated from here C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h:80: error: `QCheckBo x::QCheckBox(const QCheckBox&)' is private C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:318: error: within th is context C:/Qt/4.0.0/include/QtGui/../../src/gui/widgets/qcheckbox.h:80: error: `QCheckBo x::QCheckBox(const QCheckBox&)' is private C:/Qt/4.0.0/include/QtCore/../../src/corelib/tools/qlist.h:321: error: within th is context mingw32-make[1]: *** [release\oeueditor.o] Error 1 mingw32-make[1]: Leaving directory `J:/Progging/C++/OES/Server' mingw32-make: *** [release] Error 2
Ich kann mir darauf nicht wirklich einen Reim machen.
Wenn jemand Ideen hat, wäre ich dafür sehr dankbar.
Danke im Voraus und Ciao,
Prof. MAAD
-
Hilft es dir, wenn ich sage, dass du besser QList<QCheckBox *> verwenden solltest?
-
Danke vielmals, das hat das Problem gelöst.
Ciao,
Prof. MAAD