qml

How can set pop-up menu position in QML

旧巷老猫 提交于 2021-01-03 07:08:02
问题 I want to fix the position of pop-up menu in QML. When I click on a setting button,I want the pop-up menu will display at the fixed position. I did it by a day but can't. How can I do it in QML. Also, I want to change the size of menu item(width and Height). Hope your help! 回答1: That depends on QtQuick.Controls version. In 2.0 you can define size and position(and even more - you must do) import QtQuick 2.7 import QtQuick.Controls 2.0 //import QtQuick.Controls 1.4 import QtQuick.Window 2.0

How can set pop-up menu position in QML

时光怂恿深爱的人放手 提交于 2021-01-03 07:07:49
问题 I want to fix the position of pop-up menu in QML. When I click on a setting button,I want the pop-up menu will display at the fixed position. I did it by a day but can't. How can I do it in QML. Also, I want to change the size of menu item(width and Height). Hope your help! 回答1: That depends on QtQuick.Controls version. In 2.0 you can define size and position(and even more - you must do) import QtQuick 2.7 import QtQuick.Controls 2.0 //import QtQuick.Controls 1.4 import QtQuick.Window 2.0

How can set pop-up menu position in QML

僤鯓⒐⒋嵵緔 提交于 2021-01-03 07:07:25
问题 I want to fix the position of pop-up menu in QML. When I click on a setting button,I want the pop-up menu will display at the fixed position. I did it by a day but can't. How can I do it in QML. Also, I want to change the size of menu item(width and Height). Hope your help! 回答1: That depends on QtQuick.Controls version. In 2.0 you can define size and position(and even more - you must do) import QtQuick 2.7 import QtQuick.Controls 2.0 //import QtQuick.Controls 1.4 import QtQuick.Window 2.0

How can set pop-up menu position in QML

南笙酒味 提交于 2021-01-03 07:07:23
问题 I want to fix the position of pop-up menu in QML. When I click on a setting button,I want the pop-up menu will display at the fixed position. I did it by a day but can't. How can I do it in QML. Also, I want to change the size of menu item(width and Height). Hope your help! 回答1: That depends on QtQuick.Controls version. In 2.0 you can define size and position(and even more - you must do) import QtQuick 2.7 import QtQuick.Controls 2.0 //import QtQuick.Controls 1.4 import QtQuick.Window 2.0

How to center dialog on screen in QtQuick Controls 2?

此生再无相见时 提交于 2021-01-02 05:31:35
问题 All my dialogs appear on the top left corner of screen instead of the center. What is the best way to let the dialogs be placed automatically correct? import QtQuick 2.7 import QtQuick.Controls 2.2 ApplicationWindow { id: mainWindow visible: true width: 640 height: 480 title: qsTr("Hello World") Component.onCompleted: { showMessageBox('Hey this actually works!'); } function showMessageBox(message) { var component = Qt.createComponent("MessageDialog.qml") if(component.status == Component.Ready

QML TableView rowDelegate styleData.row not defined

蓝咒 提交于 2020-12-31 17:39:40
问题 I am trying to create a custom row delegate for a TableView . according to the Documentation, the rowDelegate should have access to a property called styleData.row . However, when I'm try to access this property, it is undefined. I used the debugger to check whats inside the styleData , and the row is missing: My code is very simple: TableView { width: 500//DEBUG height: 300//DEBUG model: ListModel { ListElement { lectureName: "Baum1" } ListElement { lectureName: "Baum2" } ListElement {

QML TableView rowDelegate styleData.row not defined

纵饮孤独 提交于 2020-12-31 17:35:45
问题 I am trying to create a custom row delegate for a TableView . according to the Documentation, the rowDelegate should have access to a property called styleData.row . However, when I'm try to access this property, it is undefined. I used the debugger to check whats inside the styleData , and the row is missing: My code is very simple: TableView { width: 500//DEBUG height: 300//DEBUG model: ListModel { ListElement { lectureName: "Baum1" } ListElement { lectureName: "Baum2" } ListElement {

QML TableView rowDelegate styleData.row not defined

99封情书 提交于 2020-12-31 17:33:47
问题 I am trying to create a custom row delegate for a TableView . according to the Documentation, the rowDelegate should have access to a property called styleData.row . However, when I'm try to access this property, it is undefined. I used the debugger to check whats inside the styleData , and the row is missing: My code is very simple: TableView { width: 500//DEBUG height: 300//DEBUG model: ListModel { ListElement { lectureName: "Baum1" } ListElement { lectureName: "Baum2" } ListElement {

QML TableView rowDelegate styleData.row not defined

半世苍凉 提交于 2020-12-31 17:20:17
问题 I am trying to create a custom row delegate for a TableView . according to the Documentation, the rowDelegate should have access to a property called styleData.row . However, when I'm try to access this property, it is undefined. I used the debugger to check whats inside the styleData , and the row is missing: My code is very simple: TableView { width: 500//DEBUG height: 300//DEBUG model: ListModel { ListElement { lectureName: "Baum1" } ListElement { lectureName: "Baum2" } ListElement {

Default arguments for qml function gives syntax errors

≡放荡痞女 提交于 2020-12-30 09:01:46
问题 This code works fine in browser hosted JavaScript environment : function foo(a=true) { console.log(a) } But doing the same in qml is giving syntax error . What might I be doing wrong ? 回答1: In QML, you should write the function as function foo(a) { if (a === undefined) a = true console.log(a) } The syntax function foo(a=true) is not supported as this syntax was introduced in ECMA-262 6th edition while QML only implements the fifth edition (as of Qt 5.11). 回答2: From Qt 5.12, this code will