Tag: qml

ubuntu应用程序的文件存储位置

在我的应用程序中,我计划在本地存储文件(导出的文件)并导入用户通过USB复制到磁盘的文件。 在哪里找到这样的应用程序文件 有一些推荐吗?

如何固定工具栏以使其保持显示状态?

始终显示的工具栏更适合指针驱动的界面 。 如何使用Ubuntu SDK将工具栏设置为(并保持)显示?

QML中的Listmodel:如何在页面堆栈中的页面切换上保留Listmodel值

我有一个XML文件来显示项目列表(listview),点击我切换到每个项目的页面,使用pagestack.push读取每个类别的XMLListmodel。 按下后再次转到同一页面导致ListModel数据丢失。 如何在不丢失ListModel数据信息的情况下将代码模块化为多个QML文件。 请告诉我。 附加示例代码段。 main.qml if(currentPageName == “menuName”) { PageStack.push(Qt.resolvedUrl(“showChosenList.qml”)); } showChosenList.qml ListModel{ id: hotelMainMenuModel } XmlListModel { id: hotelMainMenuFetch source: “hotelMenu.xml” query: “/hotelMenu/menuCategories/categoryList/mainMenu” onStatusChanged: { if (status === XmlListModel.Ready) { for (var i = 0; i < count; i++) { hotelMainMenuModel.append({"name": get(i).name, "displayText": get(i).name, "pageName": get(i).pageName}) } } } XmlRole { name: "name"; […]

ubuntu-sdk mkspec

我按照Ubuntu SDK中的说明安装了IDE。 没问题。 我可以编写一个应用程序并在桌面上运行它,但不能在我的Ubuntu BQ 4.5中运行。 该工具包错误,出现了几个错误:图1中的“找不到qt版本的Mkspec” ,“qmake不存在或不可执行”,如图2所示 并且编译器在图3中似乎未知 。 在Ubuntu 14.04上的Qt 5.2.1和Qt-Creator 3.1.1。 怎么修好?

Qt音频引擎不在Ubuntu SDK中

我使用的是Ubuntu 14.04。 我使用Ubuntu网站上的说明安装了Ubuntu SDK没有问题。 我创建了一个新的QML项目。 我想创建一个使用Qt Audio Engine的应用程序。 这是我在测试音频引擎的代码: import QtQuick 2.0 import Ubuntu.Components 0.1 import QtAudioEngine 1.0 import “ui” MainView { // objectName for functional testing purposes (autopilot-qt5) objectName: “mainView” // Note! applicationName needs to match the “name” field of the click manifest applicationName: “com.ubuntu.developer..AudioEngineTest” /* This property enables the application to change orientation […]

为什么我收到错误“无法分配给不存在的属性”头部?

我实际上是在Trusty上,我想尝试新的“head”属性,它附带了Ubuntu SDK的API 14.10。 当我启动qmlscene来测试我的应用程序时,我收到此错误: Cannot assign to non-existent property “head” 我在qml文件中导入了这个: import QtQuick 2.2 import Ubuntu.Components 1.1 谢谢你的帮助。 编辑:代码示例 import Ubuntu.Components 1.1 import QtQuick 2.2 MainView { width: units.gu(50) height: units.gu(80) useDeprecatedToolbar: false Page { id: page title: “Sections” head { sections { model: [“one”, “two”, “three”] } } Label { anchors.centerIn: parent text: “Section […]

在QML中为Ubuntu Touch使用图片作为图像对象

我正在尝试使用主图片目录(/ home / phablet / Pictures)中的图像文件作为AnimatedIMage / Image对象,但它说错误读取文件。 我已经尝试了两条路径,但都没有工作。 我知道我可以简单地在我的应用程序中包含图像,但我想在旅途中使用不同的图像。 谢谢。 AnimatedImage{ id: gifVegeta anchors.fill: parent source: ‘/home/phablet/Pictures/vegeta_charge.gif’ //source: ‘file:///home/phablet/Pictures/vegeta_charge.gif’ }

Ubuntu SDK QML如何更改TextField的背景颜色

我有一种情况,我的QML应用程序MainView的背景颜色导致文本字段条目在同样深棕色背景上有灰色字体。 这使得几乎不可能读取已输入文本字段的文本。 输入文本时,它很好,因为背景变为白色,现在可以看到深色文本,但是当未选择文本字段时,文本是不可读的。 有没有办法改变文本字段的背景颜色? 我已经尝试过更改文本颜色,它在不输入文本时有效,但是一旦我在文本字段中单击输入文本我就再也看不懂了,因为文本字段背景颜色变为白色而文本颜色也是很轻。 任何人都可以解决这个问题吗? 谢谢

如何隐藏Tabs组件的标题

我正在使用Ubuntu SDK编写应用程序,并且我在Tabs组件中有一个PageStack组件。 当我在PageStack中加载其中一个页面时,一切正常,在页眉中显示当前选项卡的名称。 但是,如果打开页面而不是从工具栏中点击“后退”按钮,我会选择另一个选项卡,它会完全混淆工具栏,然后不再显示“后退”按钮。 有没有办法让我的页面全屏,所以没有显示当前标签名称的标题(因此无法点击),甚至更好,以显示标题中当前页面的标题而不是父标签标题? Tabs { id: tabs Tab { objectName: “tabQreator” title: i18n.tr(“Create”) page: CreatorPage { id: pageCreator } } // … } 在CreatorPage.qml : PageStack { id: pageStack anchors { fill: parent } Component.onCompleted: push(pageRoot) Page { id: somePage // Toolbar definition here… } Page { id: pageRoot title: i18n.tr(“The root page”) […]

如何在QML拖放示例中发出onDropped?

在qml文档中有一个拖拉的示例 : import QtQuick 2.0 Item { width: 200; height: 200 DropArea { x: 75; y: 75 width: 50; height: 50 onDropped: console.log(“dropped”) onEntered: console.log(“entered”) Rectangle { anchors.fill: parent color: “green” visible: parent.containsDrag } } Rectangle { x: 10; y: 10 width: 20; height: 20 color: “red” Drag.active: dragArea.drag.active Drag.hotSpot.x: 10 Drag.hotSpot.y: 10 MouseArea { […]