Taking text input, manipulate it, and write to a file using QML and JS
-
Is it possible to develop QML documents that take user input, and include Javascript function from JS files so that it can manipulate the user input, then write the results to an external files, all without involving c++. The external files will be used in the c++ program later in the QT application. Any advice to point me to the right direction? Thanks!
-
Hi @pdsc_dy
Is it possible to develop QML documents that take user input, and include Javascript function from JS files so that it can manipulate the user input,
Yes
then write the results to an external files, all without involving c++.
No
The only possible way to do with QML is using local database.
-
If you want to write to a file from QML, you either have to step into C++ yourself and create some helper code, or you can try out the V-Play SDK and enjoy the fileUtils context property like this:
bool success = fileUtils.writeFile("myFile.txt", "myFileContentString")
Read more on that in our forum.
-
Hi @pdsc_dy
Is it possible to develop QML documents that take user input, and include Javascript function from JS files so that it can manipulate the user input,
Yes
then write the results to an external files, all without involving c++.
No
The only possible way to do with QML is using local database.
@p3c0 Thanks. I am trying to use QML / JS to dynamically create some C++ functions, presumably saved in a text file, which is later compiled and executed with the rest of the C++ coding. My understanding is that to achieve this I must not involve C++ in the creation of the dynamic c++ coding. Is that correct? Is there any other way to achieve it?
-
If you want to write to a file from QML, you either have to step into C++ yourself and create some helper code, or you can try out the V-Play SDK and enjoy the fileUtils context property like this:
bool success = fileUtils.writeFile("myFile.txt", "myFileContentString")
Read more on that in our forum.
-
Hi,
What exactly are you trying to do ? An IDE with Qt Quick ?
-
@SGaist I am trying to create two executables, with the first one generating outputs that will be used by the second one. I am trying to set it up such that the the user only need to click a button once and it it will be run the two executables in sequence. Is there a way to do that? If I have to do run it in two steps, I think there must be a way to combine the GUIs for the two into one. Can you let me know how? Thanks!
-
Creating an executable requires compilation thus my question. You can't just write a c++ and make it part of another application.