Plane *plane = new Plane;
scene->addItem(plane);
plane->setPos(0,0);
listPlaneAir->append(plane);
PlaneNew *plane1=new PlaneNew;
plane1->setPos(-200,200);
scene->addItem(plane1);
listPlaneLand->append(plane1);
connect(this,SIGNAL(valueChanged(int)),listPlaneAir->first(),SLOT(setSpeed(int)));
connect(this,SIGNAL(valueChanged(int)),listPlaneLand->first(),SLOT(setSpeed(int)));
报错
1>.\airport.cpp(28) : error C2664: 'QList<T>::append' : cannot convert parameter 1 from 'Plane *' to 'const Plane &'
1>.\airport.cpp(33) : error C2664: 'QList<T>::append' : cannot convert parameter 1 from 'PlaneNew *' to 'const PlaneNew &'
1>.\airport.cpp(35) : error C2664: 'bool QObject::connect(const QObject *,const char *,const QObject *,const char *,Qt::ConnectionType)' : cannot convert parameter 3 from 'Plane' to 'const QObject *'
1>.\airport.cpp(36) : error C2664: 'bool QObject::connect(const QObject *,const char *,const QObject *,const char *,Qt::ConnectionType)' : cannot convert parameter 3 from 'PlaneNew' to 'const QObject *'
其中listPlaneAir为QList<Plane>
listPlaneLand为QList<PlaneNew>