Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.8k Posts
  • QML binding executed before QObject connection

    Unsolved
    1
    0 Votes
    1 Posts
    163 Views
    No one has replied
  • Tying a context to the lifetime of a qml component?

    Unsolved
    4
    0 Votes
    4 Posts
    638 Views
    fcarneyF
    @FKosmale said in Tying a context to the lifetime of a qml component?: avoid setting context properties I guess I could create QQuickItem objects and add the relevant properties to those. I will have to think on this.
  • How to edit a cell in a model inheriting from QSqlTableModel

    Unsolved qml model-view
    7
    0 Votes
    7 Posts
    1k Views
    AhtiA
    @SGaist @Christian-Ehrlicher How would I let the view know about the data change ? And I would like to mention I am displaying the list of users with UserRole like this: QVariant UserModel::data(const QModelIndex &index, int role) const{ QVariant value; if (index.isValid()) { if (role < Qt::UserRole) value = QSqlQueryModel::data(index, role); else { int columnIdx = role - Qt::UserRole - 1; QModelIndex modelIndex = this->index(index.row(), columnIdx); value = QSqlQueryModel::data(modelIndex, Qt::DisplayRole); } } return value; } QHash<int, QByteArray> UserModel::roleNames() const{ QHash<int, QByteArray> roles; for (int i = 0; i < record().count(); i ++) { roles.insert(Qt::UserRole + i + 1, record().fieldName(i).toUtf8()); } return roles; }
  • Disable any date in QML Calendar

    Unsolved
    1
    0 Votes
    1 Posts
    177 Views
    No one has replied
  • Multiple charts on same QML page

    Unsolved
    2
    0 Votes
    2 Posts
    379 Views
    F
    @filipdns Hello, I'm trying what I need with the code below: function numberGraph() { var count= StringList.mecanoList().length for(var i=0;i<count;i++) { var trigramme=StringList.mecanoList()[i] console.log(trigramme) modelId.append({'mColor': 'blue','names':trigramme}) } } ListModel { id: modelId } BarCategoryAxis {id:categoryaxis; categories: ["2007", "2008", "2009", "2010", "2011","2012"] } Rectangle { id: rectId color: "transparent" anchors.fill: parent GridView { id: mGridViewId //anchors.fill: parent width: parent.width; height: parent.height cellWidth: parent.width; cellHeight: 300 model: modelId delegate: Rectangle { width: mGridViewId.cellWidth; height: mGridViewId.cellHeight color: mColor ChartView { width: parent.width; height: parent.height title:names StackedBarSeries { axisX:categoryaxis BarSet {id:free; label: "Free";values:[1,2,1,3]} BarSet {id:duty; label: "Duty";values:[1,2,5,0]} BarSet {id:off; label: "OFF";values:[5,3,1,4];color:"red"} } } } } } StackedBarSeries Charts are build fine but when I'm trying to scroll down, the application crash when I'm passing the seventh charts without any information on the reason, only the console message: "Can not find series on the chart." Trying to set axisX to null. Could you help me please? Kind regards
  • GridView crash when scrolling with no error even on debug mode

    Unsolved
    1
    0 Votes
    1 Posts
    142 Views
    No one has replied
  • Detect "KeyDown" event in qml

    Solved
    3
    0 Votes
    3 Posts
    623 Views
    M
    Thanks using below code works Keys.onReleased: { if(event.key === Qt.Key_Space && !event.isAutoRepeat) { // code here } }
  • QML: Custom draggable point delegate for ChartView series

    Solved
    2
    0 Votes
    2 Posts
    961 Views
    Aleksey_KA
    Found simple and elegant solution with ChartView with Repeater inside and ChartView mapping functions: mapToPosition and mapToValue to map chart<->screen coordinates easily. Mockup: import QtQuick 2.12 import QtCharts 2.3 Item { visible: true width: 640 height: 480 ChartView { id: chart anchors.fill: parent antialiasing: true ValueAxis { id: xAxis min: 0 max: 1100 tickCount: 12 labelFormat: "%.0f" } ValueAxis { id: yAxis min: -50 max: 200 tickInterval: 50 labelFormat: "%.0f" } ListModel { id: lineModel ListElement { x: 50; y: 155; } ListElement { x: 138; y: 175 } ListElement { x: 193; y: 50 } ListElement { x: 271; y: 90 } ListElement { x: 295; y: 90 } ListElement { x: 383; y: 150 } ListElement { x: 529; y: 100 } ListElement { x: 665; y: 150 } ListElement { x: 768; y: 90 } ListElement { x: 794; y: 90 } ListElement { x: 851; y: 50 } ListElement { x: 875; y: 50 } ListElement { x: 925; y: 175 } ListElement { x: 1060; y: 125 } } ListModel { id: areaModel ListElement { x: 0; y: 100 } ListElement { x: 138; y: 125 } ListElement { x: 193; y: 0 } ListElement { x: 271; y: 40 } ListElement { x: 295; y: 40 } ListElement { x: 383; y: 100 } ListElement { x: 529; y: 50 } ListElement { x: 665; y: 100 } ListElement { x: 768; y: 40 } ListElement { x: 794; y: 40 } ListElement { x: 851; y: 0 } ListElement { x: 875; y: 0 } ListElement { x: 925; y: 125 } ListElement { x: 1060; y: 75 } ListElement { x: 1100; y: 60 } } AreaSeries { name: "Terrain" axisX: xAxis axisY: yAxis borderColor: color upperSeries: LineSeries { id: areaSeries } } LineSeries { id: lineSeries name: "Flying path" axisX: xAxis axisY: yAxis } function adjustPosition(item, index) { let point = Qt.point(lineModel.get(index).x, lineModel.get(index).y) let position = chart.mapToPosition(point, lineSeries) item.x = position.x - item.width / 2 item.y = position.y - item.height / 2 } function adjustValue(item, index) { let position = Qt.point(item.x + item.width / 2, item.y + item.height / 2) let point = chart.mapToValue(position, lineSeries) lineModel.setProperty(index, "y", point.y) // Change only Y-coordinate lineSeries.replace(lineSeries.at(index).x, lineSeries.at(index).y, // old lineSeries.at(index).x, point.y) // new } Repeater { model: lineModel Rectangle { id: indicator radius: 100 width: radius / 2 height: width color: "red" property real parentWidth: chart.width property real parentHeight: chart.height onParentWidthChanged: chart.adjustPosition(this, index) onParentHeightChanged: chart.adjustPosition(this, index) onYChanged: { if(mouseArea.drag.active) { chart.adjustValue(this, index) } } Image { id: waypoint anchors.centerIn: parent source: index ? "qrc:/waypoint.svg" : "qrc:/home.svg" } MouseArea { id: mouseArea anchors.fill: parent drag.target: indicator drag.axis: Drag.YAxis preventStealing: true } } } Component.onCompleted: { lineSeries.clear() areaSeries.clear() for(let i = 0; i < lineModel.count; i++) { lineSeries.append(lineModel.get(i).x, lineModel.get(i).y) } for(let j = 0; j < areaModel.count; j++) { areaSeries.append(areaModel.get(j).x, areaModel.get(j).y) } } } } Any improvements, optimizations and suggestion like model binding via HXYModelMapper/VXYModelMapper instead of JS model filling are welcome. Will fix the answer. Result screenshot: [image: Yvmu7.png]
  • How to implement fully moving graphic applications?, I have no idea

    Unsolved
    1
    0 Votes
    1 Posts
    311 Views
    No one has replied
  • how to find intersection point of two line-series in chartview

    Unsolved qml
    1
    2 Votes
    1 Posts
    193 Views
    No one has replied
  • Hyperlinks in Qt Quick Text not working with Google Chrome

    Unsolved
    4
    0 Votes
    4 Posts
    481 Views
    A
    I just found part of the issue... My default browser is Chrome and after changing it to Firefox and Edge, both times work. So what is the deal with Google Chrome? Cheers!
  • Reading value from QML in C++

    Solved
    5
    0 Votes
    5 Posts
    793 Views
    RaadR
    @J-Hilk Thank you so much for your detailed response! now it is all clear to me!!!
  • Heap Corruption when signalling from C++ to QML

    Unsolved
    4
    0 Votes
    4 Posts
    692 Views
    JKSHJ
    @Vyuvaraj said in Heap Corruption when signalling from C++ to QML: Meaning I'm not consuming/using the information passed by the backend. What could be causing the heap to grow once I started consuming. Heap corruption does not mean that the heap is growing. Instead, it means that data was written to the wrong place in the heap. How does the backend knows the emitted signal is fully consumed? As @sierdzio said: It doesn't know, and it doesn't need to know. When the signal is emitted, the signal data is passed to the signal handler function. In your case, the signal handler is onFuncButtonChanged. The signal handler function runs from start to finish, and then the signal data is freed from memory. What happens to var l_index and var l_state and its scope? Nothing happens to them. This: Connections { target: func_BkEnd onFuncButtonChanged: { var l_index = index; var l_state = state; console.log(" AF : Function Button Changed ",l_index); func_layout.recv_func_butn_state(l_index,l_state); } } ...is the same as this: function processButton(idx, st) { var l_index = idx; var l_state = st; console.log(" AF : Function Button Changed ",l_index); func_layout.recv_func_butn_state(l_index,l_state); } Connections { target: func_BkEnd onFuncButtonChanged: processButton(index, state); } Even if you comment out myFuncRepeater.itemAt(l_index).p_buttonState = l_state;, the other code in processButton() still runs. tpKeyStates_t *m_funcKeyState_prev = nullptr; It's a good idea to convert the above to QVector<tpKeyStates_t>. Raw arrays make it easier for you to accidentally corrupt your heap. if(3 <= static_cast<unsigned int>(inputData.size()) You don't need a static_cast here.
  • Get frames from qml videoOutput and send to TcpSocket.

    Unsolved
    22
    0 Votes
    22 Posts
    4k Views
    SGaistS
    @sharath said in Get frames from qml videoOutput and send to TcpSocket.: WARNING: erroneous pipeline: could not link v4l2src0 to x264enc0 The first hit for that search on DuckDuckGo gives several example pipelines to test with your own setup.
  • ListView problems

    Solved
    2
    0 Votes
    2 Posts
    230 Views
    C
    I have a tentative solution. If I add a Connections to the modelData inside the individual component and then toggle progressWizard() onValueChanged it works. I am not sure if this is the best solution. If no one tells me otherwise here in the next few days then I will mark this as solved and move on.
  • This topic is deleted!

    Unsolved
    4
    0 Votes
    4 Posts
    33 Views
  • General Magic Map Module

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    VRoninV
    @Leaderaa said in General Magic Map Module: General Magic Map This a commercial product supplied by a 3rd party, you should reach out to the supplier for support. This looks like a great starting guide on installing though... https://www.generalmagic.com/maps-docs/generalmagic-install.html
  • ListView.onAdd not triggered with loader as delegate

    Solved
    7
    0 Votes
    7 Posts
    843 Views
    raven-worxR
    @Jim-Gir i think the problem is rather the following: The ListView only creates item in the visible area and destroys the other ones when they leave the visible area. So you wont receive a call to the onAdd handler, because the item isn't available because it is out of the visible area anyway? This can be verified by inserting the items in the first position in the model rather the last one (which always will be outside of the visible area). So yes the solution you found is the correct approach.
  • How set position for Dialog in Qt Quick Controls 2 ?

    Unsolved
    3
    1 Votes
    3 Posts
    4k Views
    I
    Thank you
  • Having problem with valgrind memcheck tool

    Unsolved
    10
    0 Votes
    10 Posts
    5k Views
    Mighty MM
    @Alien I did notice mine also saying Memory Analyzer Too finished. 98 issues were found. And there is nothing showing in the Memory Issues window. But if you click on the filter (the funnel/t shape button), and select show "External Errors" - which is the only one defaulted to off, you'll see you have errors but they are in external libraries (ie I have errors in arm-linux-gnueabihf/ld-2.28.so). You can find these by opening the error and drilling down into it.