qtquick2

FileDialog in Qml not working in Release

ⅰ亾dé卋堺 提交于 2021-02-19 06:16:29
问题 I am working on project with Qt Quick Control 2 . When I try to run my software in debug mode FileDialog.qml opens perfectly but when I deploy it as release mode it doesn't work. Here is my code: import QtQuick 2.4 import QtQuick.Window 2.2 import QtQuick.Controls 1.3 import QtQuick.Dialogs 1.0 // File Dialog to browse FileDialog { id: openDialog title: "Please Select An Image" folder: shortcuts.pictures nameFilters: ["Image files (*.BMP)"] modality: Qt.NonModal selectExisting: true /* * do

How to detect when Text gets elided

筅森魡賤 提交于 2021-02-11 13:01:45
问题 My UI contains a Text field with horizontalAlignment: Text.AlignJustify maximumLineCount: 5 wrapMode: TextEdit.WordWrap elide: Text.ElideRight When the text does not fit, the last line should end with "... MORE" where "MORE" should be focusable. This will probably be a separate Text field where the visibility is controlled by whether or not the text is elided. But how can I detect when a Text gets elided? 回答1: When a Text gets elided, it is truncated. Here's a simple example: Text { id:

How to set QML MapPolyline Path Property

走远了吗. 提交于 2021-02-08 14:57:15
问题 I have a MapPolyline object in my QtQuick Project. I need to change the path property from the C++ file, but I have no idea how to do that. My qml - File: MapPolyline { id: mapline objectName: "MapLine" line.width: 5 line.color: "green" path: {[ { latitude: 47.219791, longitude: 9.546032 }, { latitude: 47.219657, longitude: 9.542508 }, { latitude: 47.2194446, longitude: 9.5437876 } ]} } And now I want to change the content of the path property from the C++ file. Thanks for the help! 回答1: Qt

How to create/destroy dynamic objects after the same event in QML?

青春壹個敷衍的年華 提交于 2021-02-08 10:20:47
问题 I have a GridLayout dynamicLayout which has dynamically created/destroyed elements. Create/destroy happens when I click a Button myButton , for which I also provided the code below. GridLayout { id: dynamicLayout anchors.fill: parent Component { id: imageComponent Image { visible: true function deleteImage() { console.log("destroying image") destroy() } } } } Button { id: myButton visible: true x: 200 y: 200 onClicked: { createImageObjects(); } } function createImageObjects() { if

How to create/destroy dynamic objects after the same event in QML?

↘锁芯ラ 提交于 2021-02-08 10:20:23
问题 I have a GridLayout dynamicLayout which has dynamically created/destroyed elements. Create/destroy happens when I click a Button myButton , for which I also provided the code below. GridLayout { id: dynamicLayout anchors.fill: parent Component { id: imageComponent Image { visible: true function deleteImage() { console.log("destroying image") destroy() } } } } Button { id: myButton visible: true x: 200 y: 200 onClicked: { createImageObjects(); } } function createImageObjects() { if

DropArea doesn't notify about actions onEntered, onExited, onDropped

假装没事ソ 提交于 2021-02-08 06:33:27
问题 I have Rectangle filled with MouseArea which on onPressAndHold() handler reveals second Rectangle and transfers drag action to that Rectangle . The problem is that when I move that second Rectangle over DropArea it doesn't notify about any actions ( onEntered , onExited , onDropped ). I tried to do this in many combinations but it has never worked. Here is an example, am I missing something? import QtQuick 2.0 import QtQuick.Window 2.0 Window { id: appDrawerRoot visible: true width: 360;

DropArea doesn't notify about actions onEntered, onExited, onDropped

微笑、不失礼 提交于 2021-02-08 06:33:24
问题 I have Rectangle filled with MouseArea which on onPressAndHold() handler reveals second Rectangle and transfers drag action to that Rectangle . The problem is that when I move that second Rectangle over DropArea it doesn't notify about any actions ( onEntered , onExited , onDropped ). I tried to do this in many combinations but it has never worked. Here is an example, am I missing something? import QtQuick 2.0 import QtQuick.Window 2.0 Window { id: appDrawerRoot visible: true width: 360;

QT QML how to change only one feature of a, say, button style

大兔子大兔子 提交于 2021-02-08 04:01:12
问题 changing the style of a component, seems to replace all the features of the default style. is there a way to change only one feature? For example, suppose i want a red button; import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 ApplicationWindow { visible: true width: 640 height: 480 Button { height: 200 width: 200 text: "Press me" style: ButtonStyle { // changes background but also throws away everything else // in standard button style background: Rectangle {

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: