qtquick2

Disable mouse wheel for QML Slider

让人想犯罪 __ 提交于 2019-12-10 20:48:28
问题 I want to be able to scroll Flickable with mouse wheel (or two fingers on touchpad) without changing Slider s it may containt. Sample code and result application: import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 ApplicationWindow { id: rootWindow visible: true width: 400 height: 200 title: qsTr("Hello World") ScrollView { anchors.fill: parent flickableItem.flickableDirection: Flickable.VerticalFlick Column { Repeater { model: 40 Slider { width: rootWindow.width * 0.9 }

How to use FolderListModel

人走茶凉 提交于 2019-12-10 19:04:32
问题 I create a QtQuick app and replace the main.qml with the code below. I try to show all files and dirs in my home path in a Mac OS X system. But nothing shows up. Could some one help to figure out what I did wrong? Thanks in advance. import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import Qt.labs.folderlistmodel 2.1 ApplicationWindow { visible: true title: "Test" width: 200 height: 400 ListView { anchors.fill: parent

Image size different after second click on it

╄→尐↘猪︶ㄣ 提交于 2019-12-10 18:42:03
问题 I have following minimal working example, taken from my current project: import QtQuick 2.5 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.4 Window { visible: true width: Screen.width/2 height: Screen.height/2 property real ueMinOpacity: 0.00 property real ueMaxOpacity: 1.00 Rectangle { anchors.fill: parent anchors.margins: 8 border.color: "#4682b4" radius: 16 clip: true gradient: Gradient { GradientStop { position: 0 color: "#ffffff" } // GradientStop

How can I inject JavaScript file into a WebEngineView page?

孤人 提交于 2019-12-10 18:16:20
问题 I'm adding a script tag to a web page once it's fully loaded in a WebEngineView , but it's silently failing somehow. I inject the script by invoking webview.runJavaScript with this code: var s = document.createElement('script'); s.src = "qrc:/jquery-2.1.4.min.js"; document.body.appendChild(s); That's perfectly standard and to a certain extent it works as expected, i.e., if I view the html source of the page, the script tag has indeed been appended to the body. The problem is that the script

QML MouseArea propagate events to buttons

依然范特西╮ 提交于 2019-12-10 17:29:10
问题 I'm a developing an app that has a menu similar to the Gmail/Inbox app menu, for Android. Basically, when you press the button to open the menu, it slides into view. The user can swipe it away or press the buttons on the menu. For the swipe I've used the code SwipeArea from kovrov with a small change to check the speed between press and release - if it's too slow, I don't consider it a swipe. I've also set the propagate property to true on the MouseArea , i.e. propagateComposedEvents: true

Animate new items in a TableView

爱⌒轻易说出口 提交于 2019-12-10 17:13:12
问题 I'm using a TableView to display the contents of an SQLite database. The user clicks one of the checkable buttons and the right table is read through the LocalStorage API. Thus, the model is always new. Because the model is always new, the loading of the new table isn't visually attractive (all the entries are shown at once). My idea was to animate the height of the row when it's added (in a linear way from 0) Can this be done without reimplementing the rowDelegate from scratch? 回答1: Yes, it

QtQuick2: Handle onWheel event inside of a ScrollView

僤鯓⒐⒋嵵緔 提交于 2019-12-10 11:41:14
问题 I have to put component X inside of a ScrollView. Component X has to handle mouse wheel event, but ScrollView handles it. So, following example (simplified) doesn't work. How to let Rectangle's mouse area handle OnWheel event? import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Window 2.0 import QtQuick.Layouts 1.0 ApplicationWindow { width: 640 height: 480 ScrollView { height: 100 width: 100 ColumnLayout{ Rectangle { color: "red" width: 50 height: 50 MouseArea { anchors.fill:

How to implement a master-details view Qt/QML on an Android tablet?

♀尐吖头ヾ 提交于 2019-12-10 11:26:16
问题 I am porting an iOS app to Qt/QML targeting an Android tablet. I would like to keep the app's behavior similar to the original iOS version, which is based on a UISplitViewController . In other words, I need to build a master-details view using the tablet in landscape mode. In order to achieve this, I was thinking of using ListView backed by a ListModel as the master view so that whenever an item is selected in the ListView , a details view is dynamically displayed. At the moment I am

QtQuick dynamic object in a different context

时光毁灭记忆、已成空白 提交于 2019-12-10 10:56:43
问题 In my qml I'm creating a C++ component object but can't figure out how to reference the object once it's created. Here's the qml to create an OgreScene object: MouseArea { anchors.fill: parent function scene() { var scene = Qt.createQmlObject( "import Client.Plugin.Ogre 0.1; OgreScene{ id: pluginScene; engine: OgreEngine }", plugin ); console.log( "qml: init scene" ); pluginScene.init(); } onClicked: scene() } When I run it I get: Qt Debug: qml: init scene Qt Warning: qrc:///client.qml:118:

MapItemView is not updated after a dataChanged signal

前提是你 提交于 2019-12-10 10:53:56
问题 I am using the QML MapItemView component with a C++ QAbstractListModel -based model. The MapItemView is working fine when the model is reset, or whenever a new item is added or an existing item is removed. However, the MapItemView is not reflecting changes to already added items. I have first experienced this issue with Qt 5.4 but I still face it after updating to Qt 5.5 The following example shows the issue with 2 different models : a C++ model based on QAbstractListModel and a QML ListModel