如何在c++中使用QT解决这个问题

how i can resolve that in c++ using QT

本文关键字:解决 QT 问题 c++      更新时间:2023-10-16
QString fileName = QFileDialog::getOpenFileName(bla bla bla);
QFile file(fileName);
ReadXML Rxml;
Rxml.readXML(file);
我得到以下编译错误:
QFile:QFile(const QFile&) is private in definition of macro 'Q_DISABLE_COPY' within this context use of deleted function 'QFile::QFile(const QFile&)'

有人能帮帮我吗?

你不能复制QFile

重构你的readXML以接受QFile*或QFile&或者QIODevice* (qt中最灵活和常用的选项),并传递一个指针或引用。