qt-quick

qml virtual keyboard: keyboardDesignWidth and Height

非 Y 不嫁゛ 提交于 2019-12-11 06:08:44
问题 I am looking at the QML Style for the virtual keyboard. What is the purpose of keyboardDesignWidth and Height? I seem to have a lot of trouble managing the width and height of the keyboard and can never set it to how I want it. Setting the keyboardHeight and Width directly also does not help much. The issue is that the component background size is somehow computed behind the scenes. So, even when I have the keyboard buttons and size how I want, the extraneous background covers some of my

Invoke Canvas onPaint exactly once per update?

ⅰ亾dé卋堺 提交于 2019-12-11 04:14:27
问题 AKA: Canvas requestPaint() too slow; requestAnimationFrame() too fast I'm trying to create a QML Canvas that repaints as fast as possible—once per update in the main UI render loop—in order to create an FPS timer. I initially wrote this simple test: import QtQuick 2.7 import QtQuick.Window 2.2 Window { visible:true; width:100; height:100 Canvas { anchors.fill:parent onPaint: console.log(+new Date) } } I only get the callback once. So I added requestPaint(): onPaint: { console.log(+new Date)

How to make rectangle height fill ScrollView

白昼怎懂夜的黑 提交于 2019-12-11 03:44:46
问题 I have the following QML code: import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Window 2.2 Window { id: win width: 1024 height: 768 visible: true ScrollView { id:scrollView anchors.fill: parent Rectangle{ id:rect z:5 color:"red" width: 2048 height: win.height border{ color: "black" width: 2 } } } } In this code the larger Rectangle makes the horizontal scrollbar correctly appear. However, since the scrollbar takes some height from the window, the vertical scrollbar appears too.

`Screen.pixelDensity` equals 0 in non-visual components

半城伤御伤魂 提交于 2019-12-11 03:28:34
问题 I want to use Screen.pixelDensity in QML to calculate the size of my visual components. In order to keep an element's properties in one place (there are a couple of them) I created a container object: import QtQuick 2.0 Item { readonly property double constantValue: 100 * Screen.pixelDensity property double first property double second: first + constantValue // and so on Component.onCompleted: console.log(Screen.pixelDensity) // (1) } When the object is initialized, the statement (1) reports

Qt's FileDialog defaultSuffix not functionning

孤人 提交于 2019-12-11 02:32:24
问题 I'm using the following code to the new property of the filedialog under QtQuick.Dialogs 1.3 & Qt 5.10.0. I've build it using Qt Creator 5.10 default kit. import QtQuick 2.10 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.3 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") FileDialog { id: fileDialog title: "Please choose a file" folder: shortcuts.home defaultSuffix: "txt" selectExisting: false selectMultiple: false onAccepted: { console.log("You chose: " + fileUrl)

Expose 2D C++ Game Board to QML using QAbstractItemModel

这一生的挚爱 提交于 2019-12-11 02:09:22
问题 I'm writing a simple Snake game with a game board model in C++ holding a two-dimensional vector of states ( std::vector<std::vector<board::state>> ). Now I want to expose this board to QML so that it's basically some sort of grid/chess board with access to the states of the model. I've read up a lot on this topic, but still wasn't able to understand the mechanics enough to solve my problem. Applying the docs, tutorials and blog entries to my problem is my hurdle here. I subclassed

QML How to put text cursor at the end of TextEdit element

梦想与她 提交于 2019-12-10 14:48:48
问题 I have a QML TextEdit element, I plan for append some text and put the cursor at the end. My method: import QtQuick 1.1 Rectangle { color: "black" anchors.fill: parent focus: false TextEdit { id: txtCommands color: "lightGreen" anchors.fill: parent textFormat: TextEdit.RichText wrapMode: TextEdit.WordWrap font.family: "Consolas" font.pixelSize: 15 focus: true MouseArea { anchors.fill: parent focus: false } Keys.onPressed: { console.log(event.text) switch (event.key) { case 16777234: // LEFT

Error: QOpenGLShader: could not create shader - when compiling QtQuick applications with Qt5.2 Mingw OpenGL

放肆的年华 提交于 2019-12-10 13:16:07
问题 I've downloaded and installed "Qt 5.2 mingw (opengl and x86)" version. When i run Qt projects with this version of Qt, there is no problem. But when i run a Qt Quick application, the program crash and following messages log in debug: getProcAddress: Unable to resolve 'glGenRenderbuffers' getProcAddress: Unable to resolve 'glGenRenderbuffersOES' getProcAddress: Unable to resolve 'glGenRenderbuffersARB' getProcAddress: Unable to resolve 'glGenRenderbuffersEXT' getProcAddress: Unable to resolve

Getting an all-white screen on deploying Qt Quick demo app Minehunt

北城以北 提交于 2019-12-10 11:32:36
问题 To test the deployment process I am trying to deploy the included demo app Minehunt. I am able to get it to run, no crashing or errors, but the screen is all white. I believe this generally means that I am missing plugins. Dependency walker reports no problems, and I even tried including ALL the plugins from the Qt MingW plugins directory, but no such luck. Here is what I am including so far; Can anyone advise what else I need to add to get it to run? 回答1: Your dlls don't look bad at all. I

Set common property value in QML such as QSS

为君一笑 提交于 2019-12-10 09:40:50
问题 For example i have 2 different QML elemnts with common property such as: import QtQuick 2.0 Rectangle { width: 360 height: 360 Text { id: t color: "red" text: qsTr("Hello World") anchors.top: parent.top } TextInput { text: qsTr("Hello all!") color: "red" anchors.top: t.bottom } } You can see, that Text and TextInput have equal property called "color" with equal value. In QSS i can use common property value, for example: QWidget { background: "red" } and all QWidgets, that belong the qss