1. Erik Segerdell
  2. Valentina Studio
  3. Thursday, May 02 2019, 08:50 PM
  4.  Subscribe via email
We'd like to set up a widget in a form that would export data to a file, e.g. to export a table as a CSV file on the Desktop. There is a widget option Set Action > File > Write Data, which produces the code template:


f = new QFile( '/path/to/file' );
f.open( QIODevice.OpenMode.WriteOnly );
f.write( ... );
f.close();


But I can't find any further documentation on how to customize this code to make it work.

Thanks!
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello Erik,

Incorrect flag for open mode in the template.

Here's a working sample:

f = new QFile( '/tmp/test.txt' );
f.open( QIODevice.WriteOnly );
f.write( 'test text' );
f.close();
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.