qml

Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

▼魔方 西西 提交于 2021-02-07 17:28:38
问题 I'm trying to change Image with Pushbutton (GPIO PINs) stored inside a folder using QML with PyQt5 Python Code: from gpiozero import Button from signal import pause from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import * import os, time, sys def btn_pressed(): global r return lambda: r.setProperty("source", "/home/pi/Desktop/example/sample/img/img1.jpg") button1 = Button(20) myApp = QGuiApplication([]) myEngine = QQmlApplicationEngine() directory = os.path.dirname(os

QT/QML Android App, open app when click notification bar

我怕爱的太早我们不能终老 提交于 2021-02-07 14:17:47
问题 I make an QT for Android apps. When I click button notify bar seen above in tablet. But if click notify, my apps open/focus(don' know) with black window. How to do it simply. My code is: package org.ays.operation; import android.app.Notification; import android.app.NotificationManager; import android.content.Context; import android.app.PendingIntent; import android.content.Intent; public class NotificationClient extends org.qtproject.qt5.android.bindings.QtActivity { private static

draging a point on qtcharts in qml

人走茶凉 提交于 2021-02-07 08:56:21
问题 I am trying to drag a point on LineSeries on qtcharts. Here is my code: import QtQuick 2.0 import QtCharts 2.0 Item { anchors.fill: parent ChartView { title: "Two Series, Common Axes" anchors.fill: parent ValueAxis { id: axisX min: 0 max: 10 tickCount: 5 } ValueAxis { id: axisY min: -0.5 max: 1.5 } LineSeries { id: series1 axisX: axisX axisY: axisY onPressed: console.log("Pressed: " + point.x + ", " + point.y); onReleased: console.log("Released: " + point.x + ", " + point.y); } } // Add data

draging a point on qtcharts in qml

旧时模样 提交于 2021-02-07 08:56:11
问题 I am trying to drag a point on LineSeries on qtcharts. Here is my code: import QtQuick 2.0 import QtCharts 2.0 Item { anchors.fill: parent ChartView { title: "Two Series, Common Axes" anchors.fill: parent ValueAxis { id: axisX min: 0 max: 10 tickCount: 5 } ValueAxis { id: axisY min: -0.5 max: 1.5 } LineSeries { id: series1 axisX: axisX axisY: axisY onPressed: console.log("Pressed: " + point.x + ", " + point.y); onReleased: console.log("Released: " + point.x + ", " + point.y); } } // Add data

draging a point on qtcharts in qml

蹲街弑〆低调 提交于 2021-02-07 08:54:47
问题 I am trying to drag a point on LineSeries on qtcharts. Here is my code: import QtQuick 2.0 import QtCharts 2.0 Item { anchors.fill: parent ChartView { title: "Two Series, Common Axes" anchors.fill: parent ValueAxis { id: axisX min: 0 max: 10 tickCount: 5 } ValueAxis { id: axisY min: -0.5 max: 1.5 } LineSeries { id: series1 axisX: axisX axisY: axisY onPressed: console.log("Pressed: " + point.x + ", " + point.y); onReleased: console.log("Released: " + point.x + ", " + point.y); } } // Add data

Instantiating C++ objects from QML has tremendous memory usage overhead

此生再无相见时 提交于 2021-02-07 07:59:37
问题 Instantiating a QObject derived class on the heap in C++ gives me roughly about 160 bytes per object. Registering the same object via qmlRegisterType() for creation from QML and creating the object dynamically via createObject() gives me a little over 2000 bytes per object. That's quite the difference, almost 13 times more memory per object is being used when creating from QML. Note that the object doesn't have any bindings or anything extra compared to how it is in C++. Naturally, being

Instantiating C++ objects from QML has tremendous memory usage overhead

谁说我不能喝 提交于 2021-02-07 07:58:25
问题 Instantiating a QObject derived class on the heap in C++ gives me roughly about 160 bytes per object. Registering the same object via qmlRegisterType() for creation from QML and creating the object dynamically via createObject() gives me a little over 2000 bytes per object. That's quite the difference, almost 13 times more memory per object is being used when creating from QML. Note that the object doesn't have any bindings or anything extra compared to how it is in C++. Naturally, being

QML Swipeview dynamically add pages

自古美人都是妖i 提交于 2021-02-07 07:48:12
问题 I am very new to programming and trying to get swipeview to dynamically add pages. My main.qml is in the code below . I have the Settings page Serialsettings.qml displayed statically . Now i would like to add other qml pages . The way how i want to do this is by having check boxes in my settings page for each qml , and if they are ticket they should be added to the swipeview . How do i do this ? import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.1 import QtQuick.Layouts 1

Drag file from application to explorer. Can my application do the copying?

廉价感情. 提交于 2021-02-07 07:23:14
问题 In Qml I can start a drag using the text/uri-list mime type in order to start a copy action from my application into a file explorer, e.g. Item { id: draggable anchors.fill: parent Drag.active: mouseArea.drag.active Drag.hotSpot.x: 0 Drag.hotSpot.y: 0 Drag.mimeData: { "text/uri-list": "file:///home/myname/Desktop/avatar.jpeg" } Drag.supportedActions: Qt.CopyAction Drag.dragType: Drag.Automatic Drag.onDragStarted: { } Drag.onDragFinished: { console.log("Time to copy") } } // Item or Item { id:

Qt File Browser based on QML

亡梦爱人 提交于 2021-02-07 07:21:52
问题 It is easy to implement a file browser by using QFileSystemModel. But the listview UI is not pretty. So I want to implement a file browser using QML. the QML has model/view support. But how to display the filesystem tree in QML? Any clue would be appreciated. 回答1: Since Qt5.5 we have TreeView QML component available, main.qml : import QtQuick.Controls 1.4 TreeView { anchors.fill: parent TableViewColumn { title: "Name" role: "fileName" width: 300 } model: my_model } main.cpp : QFileSystemModel