qt-quick

If statement in QML

天大地大妈咪最大 提交于 2019-12-10 01:57:07
问题 Completely new to QT and QML. I'm trying to set the color of a rectangle based on the relationship between the two propery doubles callValue and handRaiseXBB , but I get the error unexpected token if" and expected a qualified name id Could anyone tell me what I am doing wrong? import QtQuick 2.0 Item{ id: hand property double callValue: 0.0 property double handRaiseXBB: 100 property string handCallColor: "green" property string handFoldColor: "grey" Rectangle { anchors.fill: hand if (hand

QtQuick, Dynamic Images and C++

元气小坏坏 提交于 2019-12-09 06:30:19
问题 I'm new to Qt, and from what I've read on qt-project.org and other places; QtQuick seems like an attractive option because of its ability to work on both pointer and touch based devices. My problem is getting it to work well with c++. I decided to write a variant of Conway's Game of Life as a next step after "Hello World". I am thoroughly mystified as to how to get the "board" -- a [height][width][bytes-per-pixel] array of char -- integrated into the scene graph. Basically, the process is

Difference between qt qml and qt quick

假装没事ソ 提交于 2019-12-08 22:46:19
问题 I'm confused with QML, QtQuick 1.0 and QtQuick 2.0. What's the difference between them? I use QtCreator 2.8.1 based on Qt 5.1.1. I want to develop a desktop program, which technology should I use? 回答1: EDIT: Please refer to @TheBootroo for a better answer Although my answer was accepted by the OP, I want to revise (or even) remove my answer. My answer was based on personal experiences with respect to Qt 5.2 in 2013 some of which is no longer valid today: QML is Qt Meta Language or Qt

Qt QML C++ QList of structs as custom ListView model

一曲冷凌霜 提交于 2019-12-08 06:41:05
问题 What I have in my project is the binary file that contains list of structure elements: typedef struct { unsigned int id; char name[SIZE]; } Entry; After reading the data from file I have all the read values stored in the following field of my class: QVector<Entry> entires; I do expose this list to QML with the following declaration: Q_PROPERTY(QVector<Entry> FileContents READ getEntries NOTIFY TmpFileUpdated) followed by getter and setter methods. inline QVector<Entry> getEntries () { return

Qt accessing model data outside ItemDelegate

我是研究僧i 提交于 2019-12-08 06:08:54
问题 I have some model class that inherits QAbstractListModel : VehiclesModel.h : class VehiclesModel : public QAbstractListModel { Q_OBJECT public: enum Roles { ImagePathRole = Qt::UserRole + 1, // QString NameRole // QString }; virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override { ... } virtual QVariant data(const QModelIndex & index, int role) const override { ... } virtual QHash<int, QByteArray> roleNames() const override { QHash<int, QByteArray> roles =

QtQuick: cannot playback any video on embedded linux

此生再无相见时 提交于 2019-12-07 16:47:23
问题 I cross compiled Qt 5.2.1 for TI AM335x board using the toolchain provided by TI together with their SDK 6.00.00. Unluckily I am not able to reproduce any video in QML... The debug console tells: defaultServiceProvider::requestService(): no service found for – “org.qt-project.qt.mediaplayer” Is there something that I am missing in cross-compilation? maybe some dependencies? Can somebody help me in determining what I am missing? You can find here my cross-compilation configuration and here the

Qt accessing model data outside ItemDelegate

旧城冷巷雨未停 提交于 2019-12-07 15:08:34
I have some model class that inherits QAbstractListModel : VehiclesModel.h : class VehiclesModel : public QAbstractListModel { Q_OBJECT public: enum Roles { ImagePathRole = Qt::UserRole + 1, // QString NameRole // QString }; virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override { ... } virtual QVariant data(const QModelIndex & index, int role) const override { ... } virtual QHash<int, QByteArray> roleNames() const override { QHash<int, QByteArray> roles = QAbstractListModel::roleNames(); roles[ImagePathRole] = "imagePath"; roles[NameRole] = "name"; return roles; } };

Scaling pixel art with Qt Quick

喜欢而已 提交于 2019-12-07 08:41:06
问题 I have a Qt Quick game that uses pixel art. For example: import QtQuick 2.2 import QtQuick.Controls 1.1 ApplicationWindow { id: window visible: true width: 300 height: 300 title: qsTr("PixelArt") Image { source: "http://upload.wikimedia.org/wikipedia/commons/f/f0/Pixelart-tv-iso.png" anchors.centerIn: parent } } I want to scale the art, so I increase the size: import QtQuick 2.2 import QtQuick.Controls 1.1 ApplicationWindow { id: window visible: true width: 300 height: 300 title: qsTr(

MouseArea inside Flickable is preventing it from flicking

旧巷老猫 提交于 2019-12-07 01:45:27
问题 I'm implementing gesture catcher (swipe left/right) with MouseArea. It should work inside Flickable with vertical flickableDirection. Also it should propagate mouse events to other elements beneath it in visual stack order. The problem is that child mouseArea with propagateComposedEvents set to true is blocking any parent's flicks before exact one click is made. After first click is made it's working correctly. Here is simplified code that is showing this. import QtQuick 2.4 import QtQuick

Qml text wrap (max width)

筅森魡賤 提交于 2019-12-06 18:36:39
问题 I would like to put text inside a bubble, and I want that my bubble be equal to the text width, but if the text length is too long, I would like the text to wrap automatically and be equal to the parent width. This code works but the text is not wrapping if text is too long: Rectangle { id:messageBoxCadre width: (modelData.messageLength>25)? (wrapper.width - 20): messageBox.width+10 height: messageBox.height+5 color: modelData.myMessage ? "#aa84b2":"#380c47" radius: 10 Text { id:messageBox