qml

qml动态加载不同的qml文件

这一生的挚爱 提交于 2019-12-17 17:05:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> import QtQuick 2.0 Item { width:100 height: 200 // Component.onCompleted: // { // // var component = Qt.createComponent("Inner.qml"); // console.log("Completed Running!") // // var obj = component.createObject(parent) // } // Rectangle{ // color: "green" // width: 200 // height: 100 function changePage() { loder_id.source = "Inner2.qml"; } MouseArea { anchors.fill: parent // onClicked: changePage(); onClicked: { loder_id.source = "Inner2.qml" } } Loader{ // var component = Qt.createComponent("Inner.qml"); // console.log("Completed Running!"); // var obj =

How do I apply the style to a TextField in QML? It seems “style” attribute isn't available

╄→гoц情女王★ 提交于 2019-12-17 16:47:14
问题 I am trying to apply some styles to a new qt 5.7 application I am working on and the following is not working at all. It gives the error: qrc:/SignInView.qml:67 Cannot assign to non-existent property "style" And I can't edit it in design mode for the same reasons. import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.4 Page { id: page1 ColumnLayout { id: columnLayout1 height: 100 anchors.right: parent.right anchors.left: parent.left anchors

How to show QSqlQueryModel in QML?

半世苍凉 提交于 2019-12-17 13:52:19
问题 I want to show QSqlQueryModel in qml TableView but I don't Wan't to create separate QML file for each new query cause I can't create infinite qml files as given here . Also question is not working for me for dynamic number of columns (could be version difference as I am using 5.11) .I just want something like:- QTableView *view = new QTableView; view->setModel(model); view->show(); in QML. I am new to qml. So far I am able show QSqlQueryModel as guided in first link but my user may enter any

How to show QSqlQueryModel in QML?

帅比萌擦擦* 提交于 2019-12-17 13:51:32
问题 I want to show QSqlQueryModel in qml TableView but I don't Wan't to create separate QML file for each new query cause I can't create infinite qml files as given here . Also question is not working for me for dynamic number of columns (could be version difference as I am using 5.11) .I just want something like:- QTableView *view = new QTableView; view->setModel(model); view->show(); in QML. I am new to qml. So far I am able show QSqlQueryModel as guided in first link but my user may enter any

Exe file does not run without QtCreator

£可爱£侵袭症+ 提交于 2019-12-17 10:49:37
问题 I installed Qt 5.0.1 for Windows 32-bit (MinGW 4.7, 823 MB) Then I created simple Quick 2 application and compiled it. Application is located in the its folder, and apllication run from QtCreator. And I want to run this exe file without QtCreator. To do this, I copy the files from the C:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin : Qt5Core.dll icuin49.dll libgcc_s_sjlj-1.dll libwinpthread-1.dll libGLESv2.dll libstdc++-6.dll qminimal.dll Qt5Gui.dll Qt5Network.dll Qt5Qml.dll Qt5Quick.dll Qt5V8.dll

Exposing complex C++ Qt object to QML

放肆的年华 提交于 2019-12-14 04:26:17
问题 In a C++ file, I have an object of the type QList<QStringList>* , which is supposed to be a two dimensional String array. Currently, in C++ I am able to do this: // this will display the QString value in the Console, // where entries is of type QList<QStringList>* qDebug() << "test: " << entries->at(0).at(0); I know how to expose this object to QML, but how am I going to be able to navigate / access its functions in QML ? In main.qml , I can call the function that returns this object: _app

How to send HTTPHeader using QT WebEngine?

 ̄綄美尐妖づ 提交于 2019-12-14 03:57:32
问题 I was playing around with QT WebEngine to make a desktop web browser which suits my requirements while working. Unfortunately, I need send some data with the HTTP Header to a site. I came across QWebEngineUrlRequestInfo class' void QWebEngineUrlRequestInfo::setHttpHeader(const QByteArray &name, const QByteArray &value) method but I don't really know how to use it in code. This is my code so far: import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 import QtWebEngine 1.3

How to change Qt 5.7 virtual keyboard layout/locale

那年仲夏 提交于 2019-12-14 03:45:37
问题 I'm writing a small windows application with Qt 5.7 using qml. For my project I would need to be able to change the virtual keyboard layout. But After hours of reading the docs and trying various things I'm still unable to achieve it. My Qt installation is default windows installation and it is up to date (just checked if there would be updates). As you can see here, the keyboard uses en_EN locale despite that my OS locale is fi_FI. And also notice that Language Change button is in disabled

QML Map visible region

↘锁芯ラ 提交于 2019-12-14 03:16:22
问题 In my application, I am using QtLocation to display a map. Since there is only QML API to render the map, here is my QML file: import QtQuick 2.0 import QtPositioning 5.5 import QtLocation 5.5 Item{ anchors.fill: parent Plugin{ id: osmplugin name: "osm" } Map { anchors.fill: parent id: map plugin: osmplugin; zoomLevel: (maximumZoomLevel - minimumZoomLevel)/2 center { // The Qt Company in Oslo latitude: 59.9485 longitude: 10.7686 } } function bbox(){ return map.visibleRegion; } } In the C++

How to forward Qt Mouse event to QQuickView?

佐手、 提交于 2019-12-14 03:09:19
问题 In my QMainWindow , I have a QFrame and a QWidget that wraps a QQuickView and displays the ui through a qml file. I am trying to implement a drag and drop functionality where, on mouse-down and mouse-move in the QFrame , a thumbnail follows the cursor's position throughout until mouse-release. The mouse-release will happen within QQuickView . The hover event within QQuickView has no issues and I can successfully get the hover event. The problem arises when on mouse-down within QFrame followed