Changes to QTemporaryFile since Qt 5.10.
On Linux, QTemporaryFile will attempt to create unnamed temporary files. If that succeeds, open() will return true but exists() will be false. If you call fileName() or any function that calls it, QTemporaryFile will give the file a name, so most applications will not see a difference. To get a real file on disk call fileName().
This commit is contained in:
parent
c8f12690bc
commit
c1b7fcd2c9
|
@ -59,6 +59,16 @@ void DumpVector(const QVector<T> &points, const QString &templateName=QString())
|
|||
|
||||
if (temp.open())
|
||||
{
|
||||
#if defined(Q_OS_LINUX)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// On Linux, QTemporaryFile will attempt to create unnamed temporary
|
||||
// files. If that succeeds, open() will return true but exists() will be
|
||||
// false. If you call fileName() or any function that calls it,
|
||||
// QTemporaryFile will give the file a name, so most applications will
|
||||
// not see a difference.
|
||||
temp.fileName(); // call to create a file on disk
|
||||
#endif
|
||||
#endif
|
||||
QJsonObject vectorObject;
|
||||
VectorToJson(points, vectorObject);
|
||||
QJsonDocument vector(vectorObject);
|
||||
|
|
|
@ -67,6 +67,16 @@ void DumpPassmarkData(const VPiecePassmarkData &data, const QString &templateNam
|
|||
|
||||
if (temp.open())
|
||||
{
|
||||
#if defined(Q_OS_LINUX)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// On Linux, QTemporaryFile will attempt to create unnamed temporary
|
||||
// files. If that succeeds, open() will return true but exists() will be
|
||||
// false. If you call fileName() or any function that calls it,
|
||||
// QTemporaryFile will give the file a name, so most applications will
|
||||
// not see a difference.
|
||||
temp.fileName(); // call to create a file on disk
|
||||
#endif
|
||||
#endif
|
||||
QJsonObject dataObject
|
||||
{
|
||||
{"data", data.toJson()},
|
||||
|
@ -92,6 +102,16 @@ void DumpPassmarkShape(const QVector<QLineF> &shape, const QString &templateName
|
|||
|
||||
if (temp.open())
|
||||
{
|
||||
#if defined(Q_OS_LINUX)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// On Linux, QTemporaryFile will attempt to create unnamed temporary
|
||||
// files. If that succeeds, open() will return true but exists() will be
|
||||
// false. If you call fileName() or any function that calls it,
|
||||
// QTemporaryFile will give the file a name, so most applications will
|
||||
// not see a difference.
|
||||
temp.fileName(); // call to create a file on disk
|
||||
#endif
|
||||
#endif
|
||||
QJsonObject shapeObject
|
||||
{
|
||||
{"shape", PassmarkShapeToJson(shape)},
|
||||
|
|
|
@ -1178,6 +1178,16 @@ void VPiece::DumpPiece(const VPiece &piece, const VContainer *data)
|
|||
temp.setAutoRemove(false); // Remove dump manually
|
||||
if (temp.open())
|
||||
{
|
||||
#if defined(Q_OS_LINUX)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// On Linux, QTemporaryFile will attempt to create unnamed temporary
|
||||
// files. If that succeeds, open() will return true but exists() will be
|
||||
// false. If you call fileName() or any function that calls it,
|
||||
// QTemporaryFile will give the file a name, so most applications will
|
||||
// not see a difference.
|
||||
temp.fileName(); // call to create a file on disk
|
||||
#endif
|
||||
#endif
|
||||
QJsonObject testCase
|
||||
{
|
||||
{"bd", piece.DBToJson(data)},
|
||||
|
|
Loading…
Reference in New Issue
Block a user