Jump to content

Qt for HarmonyOS/qtohosextras doc/File Utils Example: Difference between revisions

From Qt Wiki
Add example documentation from qdoc output (QTFOROH-2307)
 
Drop manual breadcrumb, MediaWiki renders it automatically (QTFOROH-2307)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
< [[Qt_for_HarmonyOS/qtohosextras_doc|Qt for HarmonyOS / qtohosextras doc]]
= File Utils Example =
= File Utils Example =


Line 8: Line 6:


The window contains a single button that opens a file dialog. When a file is chosen, the example calls QtOhosExtras::moveFileToTrash() and reports the boolean result in a message box. The call is synchronous and only reports success or failure.
The window contains a single button that opens a file dialog. When a file is chosen, the example calls QtOhosExtras::moveFileToTrash() and reports the boolean result in a message box. The call is synchronous and only reports success or failure.
<syntaxhighlight lang="cpp">
            bool movedToTrash = QtOhosExtras::moveFileToTrash(filePath);
</syntaxhighlight>


Files:
Files:


* [[Qt_for_HarmonyOS/qtohosextras_doc/File_Utils_Example|fileutils/fileutils.pro]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/File_Utils_Example_-_fileutils.pro|fileutils/fileutils.pro]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/File_Utils_Example|fileutils/main.cpp]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/File_Utils_Example_-_main.cpp|fileutils/main.cpp]]


[[Category:Qt for HarmonyOS]]
[[Category:Qt for HarmonyOS]]

Latest revision as of 05:34, 17 September 2026

File Utils Example

Demonstrates moving a user-selected file to the system trash.


The window contains a single button that opens a file dialog. When a file is chosen, the example calls QtOhosExtras::moveFileToTrash() and reports the boolean result in a message box. The call is synchronous and only reports success or failure.

             bool movedToTrash = QtOhosExtras::moveFileToTrash(filePath);

Files: