qml

Pass Events Between QML Objects

寵の児 提交于 2019-12-23 04:21:09
问题 I have a situation where I would like to pass a QML event to another QML item in the middle of the initial event handler. e.g. Item { id: item1 Keys.onPressed: { // Pre-process... passEventToObject(event, item2); // Post-process based on results of event passing... } } TextInput { id: item2 // Expect key press event to be handled by text input } What can I do to acheive passEventToObject ? Notes: I don't have access to modify Keys.onPressed inside item2 , it's a QML built-in ( TextInput ).

best way to get source URL of custom iOS scheme in QML

随声附和 提交于 2019-12-23 04:16:14
问题 I am new to Qt and QML and am trying to build my first App for iOS. I need to get the contents of a custom URL Scheme that I defined in info.plist (myApp://). The URL scheme works and the apps opens when I open any url myApp://xyz. Now I need to get the contents of the URL (the xyz). Trying to do that for the past days and not succeeding and also not finding a good manual on how to do it best, I ask here. What I understood so far: Some people create their own application delegates. There are

Clear QML image cache

拥有回忆 提交于 2019-12-23 03:52:09
问题 I have a QML Flickable with 3 QML image elements that cycle through 8 image files. My problem is that this uses a lot of memory on a Symbian device with very little. So when someone minimizes the app there isn't a lot of memory left for other apps. I want to know what function I can use on the focus lost event to release the cache. Otherwise Symbian closes my app when the phone runs out of memory. 回答1: I just ran into a very similar situation (literally). Apparently the QML cache is hardcoded

Clear QML image cache

喜你入骨 提交于 2019-12-23 03:52:09
问题 I have a QML Flickable with 3 QML image elements that cycle through 8 image files. My problem is that this uses a lot of memory on a Symbian device with very little. So when someone minimizes the app there isn't a lot of memory left for other apps. I want to know what function I can use on the focus lost event to release the cache. Otherwise Symbian closes my app when the phone runs out of memory. 回答1: I just ran into a very similar situation (literally). Apparently the QML cache is hardcoded

StackView: storing components along with their items

馋奶兔 提交于 2019-12-23 03:48:55
问题 Consider the following code: StackView { id: stack } Component { id: componentFooBar FooBar {} } ... stack.push({item: componentFooBar}) In the example above, according to the Qt source and documentation, after componentFooBar is pushed to the stack its inner item ( FooBar ) is loaded and pushed to the top of the inner stack. And if I want to access stack head (either by pop() or get(0) ), I'll get FooBar instance, not its Component . So for Qml StackView there's no invariant like stack.push

Display Windows Touch Keyboard

狂风中的少年 提交于 2019-12-23 03:39:11
问题 i am writing an application for windows 8 with Qt and Qml. I want a touch keyboard appears when I set focus to a text input field, such as a search box. Things like textInput.openSoftwareInputPanel(); doesn’t work for a desktop application. Windows 8 have a default touch keyboard, it is possible to display this keyboard. I can’t find any solution for this problem. Can anyone help me? 回答1: Ok i have solved the problem, with: QProcess *process = new QProcess(this); QString program = "explorer

Rebuilding again and again to view the imported QML file changes

我们两清 提交于 2019-12-23 03:30:25
问题 I have imported a qml file say A in other qml say B. Whenever I make some changes in A , it doesn't reflect in the Application. I have to again clean and rebuild to view the changes i made, which is very time-consuming. Is there an easier and efficient way of doing this, so time could be saved . Or another way of saying this is : qrc files are not added to Makefile dependencies in debug_and_release mode example A.qml Rectangle { id:xyz Button { id: ButtonA } } B.qml Rectangle{ A { id:abc } }

Swap elements in a GridView

两盒软妹~` 提交于 2019-12-23 03:21:46
问题 I'm writing a QML program that is essentially a 4x4 GridView filled with numbered rectangles. I would like to be able to: Swap two elements from the grid, dragging and dropping Allow swap only for directly adjacent elements My current problem is that as soon as I drag an element on top of another, the whole grid adjusts positions filling the gap where the element originally was. Is there any way to avoid the auto adjust behavior for that type of grid? I'm aware that the piece of code below

Swap elements in a GridView

耗尽温柔 提交于 2019-12-23 03:21:32
问题 I'm writing a QML program that is essentially a 4x4 GridView filled with numbered rectangles. I would like to be able to: Swap two elements from the grid, dragging and dropping Allow swap only for directly adjacent elements My current problem is that as soon as I drag an element on top of another, the whole grid adjusts positions filling the gap where the element originally was. Is there any way to avoid the auto adjust behavior for that type of grid? I'm aware that the piece of code below

qsTrId and .arg(): how to use it?

陌路散爱 提交于 2019-12-23 03:10:00
问题 for a project I'm forced to use qsTrId for i18n and I'm now in need of arguments in the string. Sadly, the documentation for the command does not help about. I've this sample code: Text { id: someId //% "%1 my translatable suffix!" text: qsTrId("my_translatable_id_with_argument").arg("This is") } It will output the following error: QString::arg: Argument missing: my_translatable_id_with_argument, This is The documentation for arg say it need to work with strings, so I fear that the my