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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top