[Interest] QDirIterator as Variable in class
Adrian Stern
adrian.stern at screenfood.com
Tue Apr 23 14:12:30 CEST 2013
Hello
I want to iterate trough a directory one step at a time. Driven by signals.
So after each signal I want to do another step.
I have createt the following class in which I try to create a variable of the type of QDirIterator. This however fails with the message "no matching function for call to 0QDirIterator::QDirIterator()' in the constructor.
If I comment out the mediaItr variable declaration, it works without error. So what is it I'm doing wrong? A assume its something due to my .NET background so I don't see the whole cpp scope yet.
Class.h:
class MediaBase : public QObject
{
Q_OBJECT
QObject *player;
QDir mediaDir;
QDirIterator mediaItr;
public:
explicit MediaBase(QObject *parent = 0);
void setPlayer (QObject *player = 0);
void setMediaDir (QString path);
private:
QVariant getNext();
signals:
public slots:
void movieStopped() {
if (player!=NULL) player->setProperty("thesource", getNext());
}
};
Class.cpp:
MediaBase::MediaBase(QObject *parent) : QObject(parent) {
QDirIterator mediaItr();
}
void MediaBase::setPlayer(QObject *player) {
this->player = player;
}
void MediaBase::setMediaDir (QString path) {
mediaDir = QDir(path);
if (mediaDir.exists()){
//this->mediaItr = QDirIterator(mediaDir);
}
else qDebug() << "could not load mediaDir" << endl;
}
QVariant MediaBase::getNext(){
return QVariant();
}
Freundliche Grüsse / Best Regards / Meilleures salutations
Adrian Stern
Diese E-Mail und ihre Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail inklusive Anhänge. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der Inhalte dieser Mail ist nicht gestattet.
This e-mail and any attachments may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail including the attachments. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
More information about the Interest
mailing list