Skip to content
QtWS25 Last Chance
  • Accessing either one of two components

    Unsolved QML and Qt Quick qt-quick qml binding qml dynamic
    3
    0 Votes
    3 Posts
    940 Views
    B
    Good idea, i will try that as soon as i find some spare time. Though, that cannot be the final solution. I would have to copy too much code. So, what's the right way of doing it?
  • returning objects from roles

    Unsolved QML and Qt Quick qt-quick qml models roles
    10
    0 Votes
    10 Posts
    3k Views
    ekkescornerE
    @jpnurmi cool :) did some first tests with QAbstractListModel filled with some Customer* (QObject) inserted customers, removed customers, changed properties via C++ all correct refreshed in QML ListView seems I can "port" most of my data model logic / UI from BlackBerry Cascades to Qt 5.6 :)
  • best practices when switching windows

    Unsolved QML and Qt Quick qt-quick
    4
    0 Votes
    4 Posts
    2k Views
    C
    I implemented the window change using a Layout. However, I'm not sure if this is the best approach. Here's the code: blocks.qml: import QtQuick 2.0 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.2 import QtQuick.Dialogs 1.2 Item { ColumnLayout { id: mainLayout anchors.fill: parent anchors.margins: margin Text { //id: tophead text: mc.blockheight } ListView { id: list model: mc Layout.fillHeight: true delegate: gridComp highlight: Rectangle { color: 'grey' } focus: true Keys.onPressed: { var pageDown = currentIndex+10; var pageUp = currentIndex-10; if (event.key === Qt.Key_PageDown && event.modifiers === Qt.NoModifier) { currentIndex = pageDown >= count ? count-1 : pageDown; event.accepted = true; } if (event.key === Qt.Key_PageUp && event.modifiers === Qt.NoModifier) { currentIndex = pageUp < 0 ? 0 : pageUp; event.accepted = true; } } } } Component { id: gridComp Row { Text { text: blocknum + " " MouseArea { anchors.fill: parent onClicked: { list.currentIndex = index; /* var component = Qt.createComponent("qrc:/detail.qml") var window = component.createObject(mainWindow) window.show() mainWindow.hide() */ ld.setSource("detail.qml") } } } Text { text: time + " " } } } } detail.qml: import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.2 import QtQuick.Dialogs 1.2 Item { id: detailWindow visible: true ColumnLayout { Text { text: "detail.qml" } Button { text: "Back" onClicked: { ld.source = "blocks.qml" } } } } main.qml: import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.2 import QtQuick.Dialogs 1.2 ApplicationWindow { id: mainWindow visible: true width: 640 height: 480 title: qsTr("Block Explorer") Loader { id: ld anchors.fill: parent source: "blocks.qml" } } Thanks, Ryan