Tag: qml qt5

如何在收到TextEdit :: onLinkActivated信号时打开浏览器

我想打开一个浏览器窗口,显示TextEdit onLinkActivated信号收到的URL。 是否可以从QML应用程序执行此类调用?

Qt5 Qtcreator在main.qml中使用c ++函数创建文件/ tmp /

我想基于QtQuick2ApplicationViewer模板为Ubuntu Touch编写应用程序,并且应用程序需要写入文件(例如’/tmp/test.log’)。 我使用函数/宏Q_INVOKABLE进行了测试: Q_INVOKABLE void QtQuick2ApplicationViewer::setData3(void) { qDebug() << "setData"; } ……并通过Q_INVOKABLE分享。 但我无法在我的.qml中调用该函数,并且出现错误: …main.qml:289: ReferenceError: setData3 “is not defined” 有没有人有一个工作的demo.pro文件下载? 或者使用cpp-function + qml创建文件的工作方法如下载? 在utntutouch的qtcreator版本中工作?

在Ubuntu 13.10上有Qt Quick Controls吗?

我当时希望用QML进行UI开发,我真的希望它看起来像原生的。 我找到了QtQuick.Controls( http://qt-project.org/doc/qt-5.1/qtquickcontrols/qtquickcontrols-index.html ),但是当我尝试制作一个简单的应用程序时,它告诉我QtQuick.Controls不是’安装。 main.qml: import QtQuick 2.1 import QtQuick.Controls 1.0 Rectangle { height: 200 width: 200 } 终奌站: $ qmlscene main.qml file:///tmp/main.qml:2 module “QtQuick.Controls” is not installed 另外,我从https://qt.gitorious.org/qt/qtquickcontrols/source/stable下载了源代码,运行了qmake && make ,但这返回了以下输出: cd src/ && ( test -e Makefile || /usr/lib/i386-linux-gnu/qt5/bin/qmake /tmp/qtquickcontrols/src/src.pro -o Makefile ) && make -f Makefile make[1]: Går til katalog ‘/tmp/qtquickcontrols/src’ cd […]

使用Ubuntu QML Toolkit预览播放声音

我按照http://developer.ubuntu.com/get-started/gomobile/上的说明安装了Ubuntu QML工具包预览版(稍微小提一下,让它在12.04上运行)。 我正在尝试编写一个播放声音文件的应用程序。 很明显,您可以使用QtQuick 1中的QtMultiMediakit执行此操作,但不能使用工具包中使用的QtQuick 2。 是否可以使用播放声音的工具包编写应用程序?

使用上下文属性将C ++对象嵌入到QML中

根据Qt5文档: 暴露方法包括qt槽,所有从QObjectinheritance的C ++类的公共槽都可以从QML访问这里我做了什么: C ++ class MyClass : public QObject { Q_OBJECT public slots: void doStuffFromQmlSlot() { qDebug() << Q_FUNC_INFO; } public: MyClass() { qDebug() << Q_FUNC_INFO; } }; 我的main.cpp包含: MyClass myClass; QQmlEngine engine; engine.rootContext()->setContextProperty( “myclass”, &myClass ); QQmlComponent component( &engine, QUrl::fromLocalFile(“qml/qtquick-01/main.qml”) ); component.create(); QML import QtQuick 2.0 Rectangle { width: 360 height: 360 Text […]