![]() |
MuseScore Plugins
3.5
Plugins API for MuseScore
|
Provides a simple API to perform file reading and writing operations. More...
Signals | |
void | error (const QString &msg) |
Emitted on file operations errors. More... | |
Public Member Functions | |
Q_INVOKABLE QString | read () |
Reads file contents and returns a string. More... | |
Q_INVOKABLE bool | exists () |
Returns true if the file exists. | |
Q_INVOKABLE bool | write (const QString &data) |
Writes a string to the file. More... | |
Q_INVOKABLE bool | remove () |
Removes the file. | |
Q_INVOKABLE QString | homePath () |
Returns user's home directory. | |
Q_INVOKABLE QString | tempPath () |
Returns a path suitable for a temporary file. | |
Q_INVOKABLE int | modifiedTime () |
Returns the file's last modification time. | |
Properties | |
QString | source |
Path to the file which is operated on. | |
Provides a simple API to perform file reading and writing operations.
To use this class in a plugin put
to the top part of the .qml plugin file. After that FileIO object can be declared and used in QML code:
|
signal |
Emitted on file operations errors.
Implement onError() in your FileIO object to handle this signal.
msg | A short textual description of the error occurred. |
QString read | ( | ) |
Reads file contents and returns a string.
In case error occurs, error() signal is emitted and an empty string is returned.
bool write | ( | const QString & | data | ) |
Writes a string to the file.
true
if an operation finished successfully.