How to save a text file directly without using QfileDialog box?
-
This is my sample UI, the white box is a textbox which will have some items, my main question is that when i click "Save/Refresh" qpushbutton, i want to save all of the qtextbox text into a textfile/sample_name.xml into a designated folder, but i dont wanna go through Qfiledialog box and having to decide/browse a location in which the file needs to be saved, i just want it to be saved at a fixed place in C-drive ,
and also the text in the qtextbox should again be loaded with that sample_name.xml file, i know the content is gonna be the same as i just saved it , but still i need it for some other functionality.
How can i acheive this without the involvement of qfiledialog ?
-
@Mr-Workalot said in How to save a text file directly without using QfileDialog box?:
How can i acheive this without the involvement of qfiledialog ?
Using QFile...
If you're asking how to find some specific location (not clear from your post) then see https://doc.qt.io/qt-5/qstandardpaths.html -
@Mr-Workalot But what location do you need? Where do you want to store the file? It is really not clear from your description.
Did you check the link I provided: https://doc.qt.io/qt-5/qstandardpaths.html ?
Example: to store in Documents folder call https://doc.qt.io/qt-5/qstandardpaths.html#writableLocation with QStandardPaths::DocumentsLocation as parameter