Accessing not Non-QObject-based objects from Qt Script

Is there any nice and simple way to access non QObject-based classes, such as QXmlQuery, QDateTime etc. from Qt Script?

The only way I see is to wrap QXmlQuery in another class that inherits QObject and declare as slot every function which I need to access from Qt Script:

void MyXmlQuery::setQuery ( const QString & sourceCode, const QUrl & documentURI )
{
    realxmlquery_.setQuery(sourceCode, documentURI);
}

Answers


create a interface class to do this job.

void MyXmlQuery::setQuery ( const QString & sourceCode, const QUrl & documentURI )
{
    this->realxmlquery_->setQuery(sourceCode, documentURI); //realxmlquery is a reference to the Non-qt class!
}

Need Your Help

Chinese localization not worked with PHP gettext extension as it works with English

php apache localization gettext chinese-locale

I'm already localized a website from Russian to English with PHP and gettext just with wrapping all strings into __($string) function.

How to ReadLine and retain the carriage returns and line feeds?

c# readline

When reading a line on a stream (for me it's actually a stream on a COM port), the returned string contains no \n or \r characters (or \r\n combinations). For logging purposes, I would like to ret...