The problem occurs when I define a struct like the following one
struct TInputData
{
QString filename;
QFile file;
QTextStream stream;
};
then I put this into a QVector container as follows:
QVector<struct TInputData> input(DATA_SOURCE_END);
after that I invoke some methods of the vector member fields:
for(int i = 0; i < DATA_SOURCE_END; ++i)
{
input[i].filename = QString(argv[i + 1]);
input[i].file.setFileName(input[i].filename);
if (!input[i].file.open(QIODevice::ReadOnly))
{
QDebug(QtCriticalMsg) << "Failed to open input file: " << input[i].filename << "!!!";
return a.exec();
}
input[i].stream.setDevice(&input[i].file);
qDebug() << "Connected to input file " << input[i].filename;
}
I am getting the following compilation error:
/usr/include/qt4/QtCore/qfile.h:209: error: 'QFile::QFile(const QFile&)' is private
within this context <at line where struct TInputData is declared>
And just the same regarding QTextStream.
So what am I missing?
Thanks in advance for your help.
UPDATE
The solution offered by @Ashot is to manually create TInputData objects. But it introduces some additional memory management difficulties. The workaround is smart pointers usage.