Jump to content

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

From Qt Wiki
Fix example page conversion (QTFOROH-2307)
Add code snippets to example pages (QTFOROH-2307)
Line 8: Line 8:


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>


* [[Qt_for_HarmonyOS/qtohosextras_doc/File_Utils_Example|fileutils/main.cpp]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/File_Utils_Example|fileutils/main.cpp]]


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

Revision as of 10:13, 16 September 2026

< Qt for HarmonyOS / qtohosextras doc

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);