Pergunta

I have the following:

QString themePath(":/themes/");

std::vector<QString> resourcePaths;
resourcePaths.push_back(QString("html/details.html"));

std::vector<QFile> resources;
for (std::vector<QString>::iterator it = resourcePaths.begin(); it != resourcePaths.end(); ++it) {
    QString path = QString("%1%2/%3").arg(themePath, THEME, *it);
    QFile resource(path);
    resources.push_back(resource);
}

gives me the following error: error: 'QFile::QFile(const QFile&)' is private.

I get the same error if I use QList instead of std::vector.

Thank you for your attention.

Foi útil?

Solução

The problem, is that you use QFile values in the container which implicitly perform copying of items with using the copy constructor which is private member function of QFile class. The compiler tells you that. To solve this you can try to simply store QFile pointers instead.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top