qml

Dynamically set imageSource in ImageView Blackberry 10

南笙酒味 提交于 2019-12-30 11:06:39
问题 Please help me.,i m stuck with this for more than a week.I am emitting a signal with image from my cpp file.I need to replace the default image that i placed in the imageView at QMl using this emitted image. Here is my full code. PostHttp.hpp /* Copyright (c) 2012 Research In Motion Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org

Dynamically set imageSource in ImageView Blackberry 10

喜欢而已 提交于 2019-12-30 11:05:57
问题 Please help me.,i m stuck with this for more than a week.I am emitting a signal with image from my cpp file.I need to replace the default image that i placed in the imageView at QMl using this emitted image. Here is my full code. PostHttp.hpp /* Copyright (c) 2012 Research In Motion Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org

Prevent “inherited” signal handlers from executing

泄露秘密 提交于 2019-12-30 10:42:43
问题 Defining a signal handler in a "base" component is pretty nifty when that functionality is going to be frequently used by many derived components. However, in QML installing a new handler in a derived component does not replace the original handler, it merely stacks on top of it. As handlers are not really unique per signal, they are merely connections, and you can have multiple connections per signal. One solution is to simply not provide a default handler in the base component, but then you

How to create grouped/nested properties?

人盡茶涼 提交于 2019-12-30 03:23:07
问题 I am trying to do nested properties like 'font.family' or 'anchors.fill', but I cannot initialize them in normal way because it prints 'Cannot assign to non-existent property'. Instead I am forced to use Component.onCompleted method. What's wrong? MyButtonStyling.qml: import QtQml 2.1 QtObject { property QtObject background: QtObject { property color pressed: "#CCCCCC" property color enabled: "#666666" property color disabled: "#555555" } } main.qml: import QtQuick 2.0 Item { width: 400

Create QML Element in C++?

独自空忆成欢 提交于 2019-12-30 03:22:06
问题 I have the following problem: I load an initial interface into a QQuickView using a .qml file. I then want to add QML types like an Image or Text to the interface using C++. I know I can manipulate existing elements from C++ but how can I create new types and add them? 回答1: Unfortunately the docs are a bit out-of-date (uses Qt4 api), but If you read section Loading QML Components from C++ here: https://doc.qt.io/qt-4.8/qtbinding.html Then you should have something like (with Qt5 api):

How do you access the roles of the currentItem from a listview in QML?

断了今生、忘了曾经 提交于 2019-12-30 01:55:08
问题 I'm trying to access a role from a ListView in QML. Essentially, I have this in my QML: ListView { id: myId model: myModel delegate: Item { Text { text: model.text } Text { text: model.moreText } } } myModel is a QAbstractListModel implementation. The QML portion of this is a reusable component, so the model could have any number of different roles with various data types. What I would like to do is bind to the value of a given role of the currentItem property of the ListView. In other words,

How to take ScreenShot Qt/QML

做~自己de王妃 提交于 2019-12-29 06:25:14
问题 QtQuick1 example I can’t make it work on QtQuick2 screenCapture.hpp #include <QObject> class QString; class QQuickView; class screenCapture : public QObject { Q_OBJECT public: explicit screenCapture(QQuickView *parent = 0); public slots: void capture(QString const &path) const; private: QQuickView *currentView_; }; screenCapture.cpp #include <QPixmap> #include <QQuickView> #include <QString> #include "screenCapture.hpp" screenCapture::screenCapture(QQuickView *currentView) : QObject(0),

How to make a resizable rectangle in QML?

我与影子孤独终老i 提交于 2019-12-28 12:08:07
问题 I'm looking for a simple way to create a rectangle in a QQuickItem . I want to resize, and drag the borders of this rectangle like this (found at resizable QRubberBand) Has someone an idea? 回答1: There are probably several ways to achieve the desired result. Since I've considered the implementation of a similar Component for a cropping tool software of mine, I'm going to share a toy example which uses part of that code. Differently from the rubber band in the example, my Rectangle is resizable

Downloading binary data using XMLHttpRequest, without overrideMimeType

别来无恙 提交于 2019-12-28 06:35:41
问题 I am trying to retrieve the data of an image in Javascript using XMLHttpRequest . var xhr = new XMLHttpRequest(); xhr.open("GET", "http://www.celticfc.net/images/doc/celticcrest.png"); xhr.onreadystatechange = function() { if (xhr.readyState === 4) { var resp = xhr.responseText; console.log(resp.charCodeAt(0) & 0xff); } }; xhr.send(); The first byte of this data should be 0x89 , however any high-value bytes return as 0xfffd ( 0xfffd & 0xff being 0xfd ). Questions such as this one offer

QML实现网页左右滑动的轮播图效果

允我心安 提交于 2019-12-26 07:09:25
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chyuanrufeng/article/details/82664264 网页中有很多的左右滑动的图片轮动的效果。QML实现此效果的两种方式。 PageIndicator和TabBar 也对应两种样式。 其中左右滑动的动画效果是利用SwipeView的默认切换动画效果 import QtQuick 2.9 import QtQuick.Controls 2.2 ApplicationWindow { visible= true width= 640 height= 480 title= qsTr("图片切换") SwipeView { id= swipeView anchors.fill= parent currentIndex= indicator.currentIndex Rectangle{ Image { //id= name source= "./img/0.jpg" anchors.fill= parent } } Rectangle{ Image { //id= name source= "./img/1.jpg" anchors.fill= parent } } Rectangle{ Image { //id= name source= "./img/2.jpg"