[texworks] readFile() ... retVal["message"] = QVariant();

Stefan Löffler st.loeffler at gmail.com
Wed Dec 15 07:36:43 CET 2010


On 2010-12-15 01:54, Paul A Norman wrote:
> In //Q_INVOKABLE
> QMap<QString, QVariant> TWScriptAPI::readFile(const QString& filename) const
> {
>        // relative paths are taken to be relative to the folder containing the
>        // executing script's file
>        QMap<QString, QVariant> retVal;
>
>     retVal["message"]   = QVariant();
>
> does this initially set   retVal["message"] to
>     undefined
> if not changed otherwise / assigned again later?

Yes, I guess so. Might also come out as empty string, if forced to be
converted to a string. As you can see from the code, though, it's only
valid/useful for certain status values, and for them it gives a
(translated) indication what happened. So normally, you should check the
status value, and in case of problems display the "message" string to
the user.

HTH
Stefan


More information about the texworks mailing list