문제

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