Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
fcarney last edited by fcarney
Does QTemporaryFile have move or copy semantics?
QTemporaryFile file; QVector<QTemporaryFile> files; files.push(file);
At this point if file goes out of scope I expect file to be deleted, unless I set autodelete to false. Or did the object get moved. Or am I thinking of references? At any rate I want the files vector to determine when files are deleted when it goes out of scope or is destroyed
Nevermind, it wont let me do that. I have to create a list of pointers.
Why don't you simply test it by yourself? Apart from this I don't see a move ctor anywhere in the documentation.
I didn't see any move stuff there either. However, when I attempted to do it the compiler complained about items being private in the context of the vector template. So I just went ahead and did it with pointers. I just have to clean up the pointers afterwards.
Btw, this is a really easy method of generating temp html files to be viewed by an external browser. I added it as a qml function to create a temp, put html data in it and then return the url so I can open in external browser using Qt.openUrlExternally.
JonB last edited by
Btw, this is a really easy method of generating temp html files to be viewed by an external browser.
Do you know when to keep/destroy these temporary files?
@jonb The object itself on destruction destroys the temp file, or on Linux it looks like it stores in the /tmp directory so it gets destroyed by the os. I destroy these objects when the program quits. So the soonest the file will be destroyed is when the app is closed.
JonB last edited by
Yes, just potentially a lot of temporary HTML files hanging around while the app is running :)
stores in the /tmp directory so it gets destroyed by the os
I think that means on reboot, which could/should "never happen"....
potentially a lot of temporary HTML files hanging around while the app is running
Yeah, that is a potential. They are small and are tied to printing. The idea is to use external app to print this.