qtquick2

Unused JS var in unused function + conditional causes QQmlEngine to crash on loading

懵懂的女人 提交于 2019-12-11 07:33:27
问题 This has got to be the weirdest Qt bug I've encountered so far, an unused var in a non-executed function results in a hard crash on QQmlEngine::load() . It takes those few lines of code to reproduce it: import QtQuick 2.7 import QtQuick.Window 2.2 Window { id: main visible: true width: 500 height: 300 function foo() { var c = main.width > 1 ? 27 : -147 } } It crashes on both 5.7 and 5.7.1, "stock" GCC builds from the Qt website under windoze 7 x64 and ubuntu 16.04. Adding a simple console.log

Clip children of custom qml item after custom shape

…衆ロ難τιáo~ 提交于 2019-12-11 07:15:04
问题 I have a custom QQuickItem which I created and I wanted to create a rounded cornered window. So I implemented a QQuickPaintedItem and exported to QML . The problem is that the item's children are expanding by the item's bounding rectangle, which is a rectangle and not a rounded rectangle like I want it. Here's how it looks: Here is my code: main.qml import QtQuick 2.7 import QtQuick.Window 2.2 import mycustomlib 1.0 Window { id: wnd width: 300 height: 280 visible: true flags: Qt

How to correctly implement a checkable ListView in QtQuick2?

北慕城南 提交于 2019-12-11 06:54:36
问题 Coming from C++ I dont know how to correctly implement a checkable ListView in QtQuick. For testing purposes I created a small test application. The model: class MyModel : public QAbstractListModel { Q_OBJECT public: MyModel(QObject *parent = Q_NULLPTR) : QAbstractListModel(parent) { for(int i = 0; i < 10; i++) m_items.insert(QString("item%0").arg(i), qrand() % 2 == 0 ? Qt::Checked : Qt::Unchecked); } int rowCount(const QModelIndex& parent) const Q_DECL_OVERRIDE { return m_items.count(); }

Cannot anchor to an item that isn't a parent or sibling QML QtQuick

↘锁芯ラ 提交于 2019-12-11 05:27:01
问题 I'm working on a python desktop app using QML. I have this in my QML file: SplitView { anchors.fill: parent orientation: Qt.Horizontal Rectangle { color: "#272822" id: cameraRectangle width: window.width / 2 Item { //more stuff } Item { Rectangle { anchors.top: cameraRectangle.bottom } } } Rectangle { //Rectangle info. } } I get the error that "QML Rectangle: Cannot anchor to an item that isn't a parent or sibling." On the line where I am doing anchors.top: cameraRectangle.bottom. I would

Qt: All Canvas3D rendering is broken when GL ES 3.0 is requested

时间秒杀一切 提交于 2019-12-11 05:15:06
问题 I've distilled this to a completely trivial testcase. In main() I request a GL ES 3.0 context. In the Canvas3D code I first I setup all low-level stuff like shaders, vertex buffers and matrices. Then I draw a white triangle. The results is a window that alternates between all black and white (flickers) at a high frequency. I.e. completely buggy. Changing the 3.0 version I request to 2.0 fixes it, and, in my real app, and lets all other GL functionality work fine. Note that QML items other

QT Quick (QML) assemble mac-.bundle -> not a dynamic library error when using macdeployqt

扶醉桌前 提交于 2019-12-11 05:09:38
问题 I struggle with this for weeks now and hope someone finds this useful or knows an answer. - I use QT 5.7 and QT 5.8 and the error occurs on both versions. I have a QT Quick 2.0 application which I build as a dynamically linked .bundle application on a Mac using macdeployqt. I call macdeployqt with the following parameters: %{buildDir}/imageDatabase.app -qmldir=%{buildDir}/../UserInterface/ -always-overwrite -verbose=2 The working directory is $QTDIR/bin because macdeploy needs to be run from

Non-native Dialog in Qt Quick 2 application

こ雲淡風輕ζ 提交于 2019-12-11 05:01:23
问题 How to make dialogs from import QtQuick.Dialogs to be non-native, non- QDialog -derived ( QFileDialog etc)? It is possible to make QFileDialog to be non-native (QFileDialog::Option::DontUseNativeDialog). But how to make dialogs in QML to be rendered on xcb QPA and on eglfs QPA in the similar way? 回答1: Changing this QApplication app(argc, argv); to this QGuiApplication app(argc, argv); does the trick for Dialog , but not FileDialog . It essentially tells QtQuick.Dialogs that you're not using

Qt 5.12 TableView Header Delegate

孤人 提交于 2019-12-11 04:53:55
问题 I've created this table view in Qt 5.12 with new TableView but I don't know how to create header for it, I read documentation there is no headerdelegate for it neither. Here some screenshot: so how can i add headerDelegate for 5.12 TableView? import QtQuick 2.12 import QtQuick.Controls 2.12 ApplicationWindow { visible: true ListModel{ id:tableModel ListElement{ identifier:1 name:'value' title: 'test' } ListElement{ identifier:2 name:'value2' title: 'test2' } } width:1000; height: 500 //

Instantiate inline Component without Loader

牧云@^-^@ 提交于 2019-12-11 04:21:09
问题 Is there a way of instantiating an inline Component (i.e. defined in the same file) without using a Loader ? I'm less concerned about the performance impact of using Loader s as I am about polluting my file with lots of Loader wrappers. 回答1: You can use a Repeater to create components without Loader . Or you can even use Qt.createComponent to do that. Take a look at Qt Documentation about Dynamic Component Creation in QML information and examples about Repeater can be found here You can even

Animate snap in ListView

核能气质少年 提交于 2019-12-11 04:14:10
问题 I would like to animate the "snap" effect when a ListView snaps to a specific item. I enable "snapping" with the snapMode: ListView.SnapOneItem property. Currently it just de-accelerates to the current item and stops, but it would be nice if I could get it to make a "bounce" effect when it stops. Any ideas about how I can do this? Flickable has a rebound property, but this seems to not work for the snapping on elements inside a ListView . 回答1: Since you used SnapOneItem , you can insert a