How to make QML items to grow to fit contents?

You must give a size to containers, and add anchors / bindings in children : main.qml : import QtQuick 1.1 import “Teeworlds” as Teeworlds Item { width: 800; // root item so give a size height: 600; Flickable { clip: true; anchors.fill: parent; // use a flickable to allow scrolling contentWidth: width; // flickable content … Read more

Different delegates for QML ListView

I’ve had the same problem, the Qt documentation is providing a pretty good answer: http://doc.qt.io/qt-5/qml-qtquick-loader.html#using-a-loader-within-a-view-delegate The easiest solution is an inline Component with a Loader to set a source file: ListView { id: contactsView anchors.left: parent.left anchors.top: parent.top width: parent.width height: parent.height orientation: Qt.Vertical spacing: 10 model: contactsModel delegate: Component { Loader { source: switch(position) … Read more

declare global property in QML for other QML files

Use a QML Singleton. Please reference “Approach 2” on this page — The ugly QTBUG-34418 comments are mine. These are the pieces you need: Style.qml pragma Singleton import QtQuick 2.0 QtObject { property color mainbg: ‘red’ } qmldir This file must be in the same folder as the singleton .qml file (Style.qml in our example) … Read more

Qt5. Embed QWidget object in QML

Qt Quick 2 uses a scene graph for efficient rendering on the GPU. Unfortunately this makes it impossible to embed classic widgets into the scene. The old approach to embed such widgets with the help of QGraphicsProxyWidget works only with Qt Quick 1, because internally it uses a QGraphicsView for all the heavy lifting and … Read more

How to create delay function in QML?

As suggested in the comments to your question, the Timer component is a good solution to this. function Timer() { return Qt.createQmlObject(“import QtQuick 2.0; Timer {}”, root); } timer = new Timer(); timer.interval = 1000; timer.repeat = true; timer.triggered.connect(function () { print(“I’m triggered once every second”); }) timer.start(); The above would be how I’m currently … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)