0

I'd like to write a QML application for Tumblr.

I try simply to copy paste code from the Console examples but obviously it has not worked. I can't find if I have to download something or I don't know...the problem seemed to be require(): QtCreator tells me

"ReferenceError: require is not defined".

So, in conclusion, there's a guide from very very new users about these things? I would like to read a step by step guide for what I have to do, what I have to download where I have to put the files, etc.

4

2 回答 2

0

这是解释 QtQuick Javascript 实现的一些微妙之处的页面:Integrating Javascript

您应该特别阅读以下部分:

  • 无状态 JavaScript 库
  • 从另一个导入一个 JavaScript 文件

我不知道 tumblr API 或 require.js 的内部结构,但如果它们使用特定于浏览器的东西,它们将无法与 Qml 引擎一起使用。

然后你会有一些解决方案:

  • 使用 python tumblr api + pyqt(还不支持 QtQuick2,但这应该与下一个 pyqt5 版本一起提供)或 ruby​​ 版本(仅限 qt4)
  • 用 C++ 处理 tumblr 的 api(但我不认为他们提供了方便的 api?)
  • 使用来自 qml/javascript “手动”的 tumblr 的 rest api(使用来自全局 qml 对象的 XmlHttpRequest 和 JSON.parse())
于 2013-08-16T22:48:17.677 回答
0

好吧,关于require问题,事情是 tumblr.js 库在 nodejs 上工作,正如您在Tumblr.js API 的另一个沮丧的用户那里看到的那样 - require() 失败

于 2013-12-14T14:13:16.680 回答