开发者

Accessing not Non-QObject-based objects from Qt Script

开发者 https://www.devze.com 2022-12-23 18:31 出处:网络
Is there any nice and simple way to access non QObject-based classes, such as QXmlQuery, QDateTime etc. 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, docu开发者_运维问答mentURI);
}


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!
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号