qml

QQuickWidget: grabToImage: item's window is not visible

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 11:00:48
问题 I'm having a problem when I try to use Item::grabToImage() qml method. No matter which item I point to, it always says the following error: grabToImage: item's window is not visible I tried using the root/toplevel Item named rect too, but it didnt work. My goal: I want to capture a rectangle sized image with the map tile and polygon draw on it Below there's a minimal reproducible example import QtQml 2.2 import QtLocation 5.9 import QtPositioning 5.9 import QtQuick 2.0 import QtQuick.Controls

How to make Flickable ensure the visibility of an item inside of it?

淺唱寂寞╮ 提交于 2021-01-28 07:40:41
问题 I have a Flickable that includes a large number of TextField objects laid out in a column with each TextField anchored to the bottom on the previous TextField. Everything is working fine except that when I use the tab key to navigate through these fields, eventually the focus goes to a TextField that is outside the visible rectangle of the Flickable and then the user can't see the cursor until they scroll down the Flickable manually. Essentially I'm looking for some kind of ".ensureVisible()"

Unicode in QML/C++ issue

删除回忆录丶 提交于 2021-01-28 07:31:55
问题 In QML I have a TextArea. When I set the text property of this TextArea to "ÆØÅ" it shows "ÆØÅ" when the program runs. I also get text through some functions that I want to show in the same TextArea, but then "ÆØÅ" is shown as "???". The strings come from this C++ function: QString Tts::morseToChar(QString morse) { if(morse == ".-") return "A"; else if (morse == "-...") return "B"; ... ... else if (morse == ".-.-") return "Æ"; else if (morse == "---.") return "Ø"; else if (morse == ".--.-")

Unicode in QML/C++ issue

北战南征 提交于 2021-01-28 07:19:18
问题 In QML I have a TextArea. When I set the text property of this TextArea to "ÆØÅ" it shows "ÆØÅ" when the program runs. I also get text through some functions that I want to show in the same TextArea, but then "ÆØÅ" is shown as "???". The strings come from this C++ function: QString Tts::morseToChar(QString morse) { if(morse == ".-") return "A"; else if (morse == "-...") return "B"; ... ... else if (morse == ".-.-") return "Æ"; else if (morse == "---.") return "Ø"; else if (morse == ".--.-")

How to create a splash screen using QML

喜你入骨 提交于 2021-01-28 06:50:25
问题 I am trying to develop an android application using QT. I want to show a splash screen at the start of the application. Splash screen will stay there for 2 seconds then main page of the app will be shown. For this I have created 2 .qml files. Splash.qml import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Window 2.3 Window { id: window visible: true width: Screen.width height: Screen.height signal timeout Image { id: image anchors.horizontalCenter: parent.horizontalCenter anchors

Pause application in QML when app is in background Symbian

白昼怎懂夜的黑 提交于 2021-01-28 06:08:14
问题 I want to know of any pure QML way to find out whether the application is in the background or not and then accordingly stop or play music. In meego the alternate way to do is through the PlatformWindow Element but it does not exist in Symbian QML. Help needed please 回答1: Finally I got it working :) and i did it though Qt way... here are the steps 1) Create a class MyEventFilter class myEventFilter : public QObject { bool eventFilter(QObject *obj, QEvent *event) { switch(event->type()) { case

Translate Qt QML application on the fly

本秂侑毒 提交于 2021-01-28 06:00:55
问题 I'm trying to translate a qt QML application that is filled with tr("string"); All over the place, If I set the translator before the app starts it works perfectly, but I'm having troubles doing it on the fly. The only solution seems to be the empty string hack but I dont want to search for every "tr" and add the empty string 回答1: Up to Qt 5.9 , the easiest solution is to add an empty string to each translatable string: How to do dynamic translation in QML From Qt 5.10 , it is possible to

How to enable TextField selection handlers with QtVirtualKeyboard on a QQuickWidget?

坚强是说给别人听的谎言 提交于 2021-01-28 05:07:30
问题 I am integrating QtVirtualKeyboard in my QML app and this causes selection handlers to appear in text fields when some text is selected as shown below. However the handlers are not draggable if I integrate my QML app using a QQuickWidget. Instead it prints out an error: QMetaObject::invokeMethod: No such method QQuickWidget::inputMethodQuery(Qt::InputMethodQuery,QVariant) Here is a minimal reproducible example: main.cpp: #include <QApplication> #include <QQuickWidget> int main(int argc, char

GridLayout Arrangement

社会主义新天地 提交于 2021-01-28 02:25:43
问题 Following is my main.qml : Window { id: window visible: true width: 800 height: 480 title: qsTr("Hello World") ListModel { id: _listModel ListElement { textData: "E1" isEnabled: false } ListElement { textData: "E2" isEnabled: false } ListElement { textData: "E3" isEnabled: false } ListElement { textData: "E4" isEnabled: false } ListElement { textData: "E5" isEnabled: false } ListElement { textData: "E6" isEnabled: false } } ListView { id: _listview model: _listModel width: 100 height: parent

import QtQuick.Controls 2.1 QML MODULE NOT FOUND

倾然丶 夕夏残阳落幕 提交于 2021-01-27 23:45:07
问题 I am using Qt Creator 2.4.1 base on Qt 4.7.4(32 bit) on windows. I have to create a table in QML using Table View. When i try import QtQuick.Controls 2.1 i get the error QML MODULE NOT FOUND. Same error on Qt Creator 2.6.2 based on Qt 5.0.1. Any help appreciated. 回答1: The module QtQuick.Controls has been added on Qt 5.1 and is currently at the 1.0 version. It also requires you having QtQuick version 2.0, introduced with Qt 5 So if you want to use TableView you would have to update your