标签: ubuntu-touch

如何在纯QML + JS中创建循环进度条?

我的应用程序是使用QML + JS制作的,我希望创建一个循环进度条小部件.我可以使用QML矩形创建圆,并将其半径设置为等于宽度/ 2,使其成为圆形.如何创建进度条呢?

我打算实现以下模型.

在此输入图像描述

javascript qml ubuntu-touch

19
推荐指数
2
解决办法
1万
查看次数

QML 中的 Moment.js

我正在寻找一种很好地格式化日期的方法。看起来 moment.js 会给我我想要的东西,但我不知道如何从 QML 或 Javascript 文件(这是针对 Ubuntu Touch)使用它。

我已经从网站上下载了 with-langs 文件(并将其重命名为“moment.js”),然后尝试“import 'moment.js' as moment”和“Qt.include('moment.js')” ,但似乎仍然无法使用它。

关于如何使这项工作的任何想法?

javascript qt qml momentjs ubuntu-touch

6
推荐指数
1
解决办法
619
查看次数

获取传感器值Ubuntu Touch

我是Ubuntu应用程序的新手,我正在尝试为Ubuntu Touch创建一个应用程序来读取传感器的值(Accelerometer,Gyroscope,...),但我不知道从哪里开始.使用哪种语言?QML,C++ ..我已经在网上进行了彻底的搜索,我在ubuntu touch中找不到使用传感器的单个示例应用程序.

我曾尝试将QtMobility和QtSensors插件与QtCreator一起使用,但它只在桌面上运行代码.当我尝试在设备上运行应用程序时,会显示一条消息,指出未安装模块.因此,我不知道QtSensors是否在Ubuntu Touch中实现,或者即使这是在Ubuntu touch中访问传感器的正确方法.

ubuntu qt sensor ubuntu-touch

5
推荐指数
1
解决办法
685
查看次数

如何在 ubuntu Touch 设备上安装应用程序

我一直在研究 Ubuntu Touch。

所以我按照此处的说明Nexus 10 上安装了 ubuntu

我按照此处的说明构建了示例应用程序

所以现在我有一个运行 ubuntu touch 的设备和一个应用程序,我如何将应用程序放在设备上?

ubuntu mobile touch ubuntu-touch

5
推荐指数
0
解决办法
1377
查看次数

ListView PullToRefresh 在上方一行下隐藏“拉动刷新”字符串

我正在创建一个 QML 布局,里面有一个Column和多个Rows。第一行包含一个按钮,第二行包含从网络服务中检索到的项目列表。我希望能够做到“拉刷新”就行了,所以我用PullToRefreshListView

但是,这会将可见字符串“Pull to refresh...”添加到行输出的顶部,实际上出现在第一行的顶部附近。这种是有道理的,除了我希望该文本隐藏第一行,直到它在第二行中的列表被拉出时滑出。

这是要重现的最小 QML,可以使用以下命令运行qmlscene

import QtQuick 2.4
import QtQuick.XmlListModel 2.0
import Ubuntu.Components 1.3

MainView {

    id: root
    width: units.gu(50)
    height: units.gu(75)

    Column {
        Row {
            Button {
                id: selector
                text: "Select"
            }
        }
        Row {
            ListView {
                id: listOfThings
                height: 500
                width: 400
                model: things
                delegate: Text {
                    text: title + " (" + pubDate + ")"
                }
                PullToRefresh {
                    refreshing: things.status …
Run Code Online (Sandbox Code Playgroud)

listview qml qtquick2 pull-to-refresh ubuntu-touch

5
推荐指数
0
解决办法
597
查看次数

如何在QML中动态添加组件?

我正在尝试按下按钮时动态创建一个组件,然后将其添加到当前父级.我不确定我在这里做错了什么,

我有这个简单的布局:

import QtQuick 2.0
import Ubuntu.Components 0.1
import "components"
import "componentCreation.js" as MyScript

/*!
    \brief MainView with a Label and Button elements.
*/

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..SpritePractice"

    /*
     This property enables the application to change orientation
     when the device is rotated. The default is false.
    */
    //automaticOrientation: true

    width: units.gu(100)
    height: units.gu(75)

    Page {
        title: i18n.tr("Simple")

        Column …
Run Code Online (Sandbox Code Playgroud)

qt qml ubuntu-touch

4
推荐指数
1
解决办法
2万
查看次数

有条件地包括基于属性值的组件

我有一个ListView,它显示来自API的一些数据.在我的列表项中,我需要有两个不同的组件树,具体取决于该行的数据.更具体地说,如果行具有关联的图像,我需要以特定方式显示带有标签的图像.如果它没有图像,那么我想只显示一个标签,以不同的方式排列.对我来说,这听起来像我想要创建两个不同的组件,并动态选择要包含的组件.

它目前看起来像这样,缩写形式:

ListItem.Empty {
    id: matchItem
    property string team1Name
    property string team2Name
    property string team1Logo
    property string team2Logo

    width: parent.width

    Item {
        id: team1Info
        width: parent.width*0.3

        anchors {
            left: parent.left
            top: parent.top
            bottom: parent.bottom
        }

        Item {
            anchors.fill: parent
            anchors.margins {
                top: units.gu(2)
                bottom: units.gu(2)
            }

            Image {
                id: team1LogoImage
                source: team1Logo
                width: parent.width
                height: units.gu(5)
                fillMode: Image.PreserveAspectFit
                anchors.horizontalAlignment: parent.horizontalCenter
            }

            Label {
                text: team1Name
                anchors.horizontalAlignment: Text.Center
            }
        }
    }

    // Some more elements and a repeat of the above …
Run Code Online (Sandbox Code Playgroud)

qml ubuntu-touch

2
推荐指数
2
解决办法
4231
查看次数