Unsolved QFtp list()
-
I have now created a second connect method and a function "addToList()" like this:
connect(m_ftp, SIGNAL(listInfo()), this, SLOT(addToList()));
and now?
-
@magguz
HGi
its :listInfo(const QUrlInfo & i)
so syntax is not correctconnect(m_ftp, SIGNAL(listInfo(const QUrlInfo &), this, SLOT(addToList(const QUrlInfo &));
and change addToList so it takes that parameter.
For each file it calls it
and you can build your list or what you need. -
@mrjj said in QFtp list():
and change addToList so it takes that parameter.
how I can take the parameter into the addToList function?
-
@magguz
just change the addToList so it the real slot have a variable name.
(not in the connect. they are always without names)void addToList(const QUrlInfo & file);
-
I changed the addToList() to addToList(const QUrlInfo & file)
Now I get an object named "file" for every directory entry, right? -
@magguz
yes you get an URL object for each file
and the (QUrlInfo) file has a function called
name() that returns a QString. -
now I want to append the strings to a textEdit like this:
ui->textEdit->append(file.name());
but it doesn't work
-
@magguz
in what way "doesn't work" ?
What does it append?
is the addToList called ? -
@mrjj said in QFtp list():
@magguz
in what way "doesn't work" ?
What does it append?
is the addToList called ?no it seems that addToList is not called. It appends nothing.
-
@magguz
well check all your connects like
qDebug() << "status:" << connect(xxxx); // xxxx being what u have
and see they return true.
also test that it does connect to the server. check errors and such. -
I found what was wrong. I changed
ftp->login("","");
in
ftp->login();
and it works. Thanks for your help!
-
There is still one thing: In the TextEdit he lists all entries sixteen times
-
-
I changed the connect statements like this:
connect(ftp, SIGNAL(listInfo(const QUrlInfo &)), this, SLOT(addToList(const QUrlInfo &)), Qt::UniqueConnection);
I added only Qt::UniqueConnection as parameter. Now everything is fine :-)
-
@magguz
Ahh, you might have added the connect many times :)
well UniqueConnection solves also :)