Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • Is it possible to invoke C++ function before an item draw by qml?

    Solved
    3
    0 Votes
    3 Posts
    317 Views
    AlienA
    Dear @rrlopez Ok I see thanks
  • Qt Quick - What about the future of TableView and TableViewColum?

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    jeanmilostJ
    @J-Hilk, Thank you very much
  • Strange behavior with dynamically removed objects

    Unsolved
    2
    0 Votes
    2 Posts
    148 Views
    GrecKoG
    My advise (as most of the time on the forum :P ), would be to not do things like you are doing. Manipulating UI items is not very mainenable and flexible. You should act on your data instead. I don't really know what is your use case, but most of the time you should avoid using Qt.createObject or Qt.createComponent and let view/models class handle the instantiation of your dynamic objects. In your example, you could use a Repeater with a model (an int, a js array, a ListModel, ...). I rewrote it with a ListModel : import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") ListModel { id: listModel } ColumnLayout { RowLayout { Button { text: qsTr("Add") onClicked: listModel.append({text: listModel.count + 1}) } Button { text: qsTr("Remove") onClicked: { if (listModel.count > 0) listModel.remove(0); } } Button { text: qsTr("Clear & Add New 3") onClicked: { listModel.clear(); for (var i = 0; i < 3; ++i) { listModel.append({text: listModel.count + 1}) } } } } ColumnLayout { Repeater { model: listModel Label { // you can replace that with OwnLabel text: "My text: %1, my index: %2".arg(model.text).arg(model.index) } } } } }
  • what should I use one to draw opengl-3D-map on qml?

    Unsolved
    1
    0 Votes
    1 Posts
    160 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    13 Views
  • Qml JS Array callBackFn

    Solved qml qml + js javascript foreach array
    4
    0 Votes
    4 Posts
    2k Views
    K
    Thanks guys! Im on Qt 5.10, that explains why the "=>" is not working. Had not known about the old style syntax. Settings this to closed.
  • Q_PROPERTY Vs Q_INVOKABLE

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    jsulmJ
    @QtQmlLearner said in Q_PROPERTY Vs Q_INVOKABLE: Q_INVOKABLE is used to make functions accessible throughout Qt meta object system Yes, that's all it does, Q_PROPERTY has more possibilities to access members of a class: you can define setter and getter, notifications and more. So, what to select really depends on what you need. If you only want to make a method invocable then use Q_INVOKABLE, if you need something like a property with getter/setter/... then use Q_PROPERTY.
  • QML resp api failed on qt.network.ssl:QSslSocket: cannot resolve SSLv2_client_metho

    Unsolved
    5
    0 Votes
    5 Posts
    450 Views
    Pablo J. RoginaP
    @weza_hss said in QML resp api failed on qt.network.ssl:QSslSocket: cannot resolve SSLv2_client_metho: I have installed on my OS is 1.1.1d that is the last It's the last for the 1.1.x release. You were told by @SGaist to "install the latest of the OpenSSL 1.0 series" see here
  • How to test qml listview with qml TestCase.

    Unsolved
    1
    0 Votes
    1 Posts
    195 Views
    No one has replied
  • Change Image source from c++

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    C
    @J-Hilk Thanks all for the replies, quite a lot of info here. Apologies but could someone recommend how I go about integrating this into my code sample above. I'm still a bit of a newbie. Just to get me started
  • [SOLVED]ObjectModel unknown component (M300)

    10
    0 Votes
    10 Posts
    13k Views
    D
    I know it's old but can be useful. In the project settings, in the qmake settings box, check "Enable QML debugging and profiling" and "Enable Qt Quick Compiler" resolve the problem. The object is not marked as unknown anymore.
  • How to link to another qml page via onClicked?

    Unsolved
    2
    0 Votes
    2 Posts
    196 Views
    sierdzioS
    Yes it is OK to load pages via Loader element. Is that what you are asking? If you have a set of pages you want to switch between, you can use StackView, SwipeView etc. instead.
  • Is it possible to set condition base on color for OnClicked ?

    Unsolved
    5
    0 Votes
    5 Posts
    590 Views
    mfatihM
    @kkai295 Glad, it helped. As @GrecKo pointed out (good point, thanks), it may be a little bit verbose for simple cases, but for more complex cases, I believe states might be useful.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • 1 Votes
    1 Posts
    741 Views
    No one has replied
  • Array of ListModel

    Unsolved listmodel arrange in grid containers
    2
    0 Votes
    2 Posts
    557 Views
    IntruderExcluderI
    If data at that models is uniform it is better to have 1 model and change its data. Anyway, JS arrays can be used as models too, so you can have array of arrays.
  • Qml Testcase mouse drag

    Unsolved
    1
    0 Votes
    1 Posts
    209 Views
    No one has replied
  • modelData and ListView

    Solved
    3
    0 Votes
    3 Posts
    432 Views
    C
    @Leonardo Okay well this particular ListView has this model: model: presentationManager.settingsPresenter.propertiesForDevice I checked and propertiesForDevice() is defined as: QList<QObject*> propertiesDevice();
  • Accessing role values using an index in a model

    Solved
    6
    0 Votes
    6 Posts
    2k Views
    GrecKoG
    I've create a small lib related to your problem : https://github.com/oKcerG/QmlModelHelper You can query the roleNames of an arbitrary model with model.ModelHelper.roles as a map property or model.ModelHelper.roleForName("roleName") returning an int. There's also some convenience data method like model.ModelHelper.data(row, "roleName").
  • Panes/Ids dont seem to work with objects crated from a C++ context

    Unsolved
    8
    0 Votes
    8 Posts
    538 Views
    sierdzioS
    I see. IDs in separate JS files do work, indeed, as long as the ID comes from the QML file which includes the script. I don't think I know how to help, sorry :-( Perhaps it is indeed something about initialization on C++ side, or I still misunderstand what's going on, I don't know.