Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • View3D

    Unsolved
    1
    0 Votes
    1 Posts
    142 Views
    No one has replied
  • How to Display Frames in QML from C++ for Real-Time Applications

    Solved
    16
    1 Votes
    16 Posts
    1k Views
    B
    @Wertyus said in How to Display Frames in QML from C++ for Real-Time Applications: Did you experience any latency issues with the QQuickPaintedItem approach when handling high frame rates (e.g., 30 FPS)? I did some initial experiments to test the viability of the general approach and was able to get frame rates above 30fps. Since implementing the real thing, I have not explicitly measured this but it has been good enough for our purposes. In our case, the frames are provided not by a video stream but by a rendering of a 3D model provided by a back end server. Using QQuickPaintedItem was driven by our need to be able to react to mouse events and so on that are fed back to the server. It might be that for your case, treating it as a video stream and using the specialised support for that would be more appropriate. Also, how did you handle buffer updates efficiently when new frames arrived? This is a sketch of the code in the QQuickPaintedItem. Because it's a "pull" approach, it is possible that frames could arrive too quickly for this to display all of them and anything between the last image requested and the current one will have been dropped. void ViewerItem::checkForNewImage() { // Called on timer trigger // Note no significant copying here. // `imageProvider` works on separate thread; `currentImage()` is mutex protected internally std::pair<std::shared_ptr<Image>, int> image = imageProvider->currentImage(); if (image.second != m_currentIndex) { // New image - update the pixmap member m_pixmap.convertFromImage( QImage(image.first->pixelBuffer(), image.first->width, image.first->height, image.first->width*3, QImage::Format_RGB888 ) ); // New image so update index m_currentIndex = image.second; // update() is QQuickPaintedItem member - will call `paint(QPainter*)` on the present class // our implementation of paint() uses `drawPixmap(0, 0, m_pixmap)` update() } }
  • Duplicate items in ListView

    Unsolved
    7
    0 Votes
    7 Posts
    975 Views
    GrecKoG
    They are still visible but they shouldn't be displayed anymore. If not it warrants a bug report
  • How to Dynamically Load Candlesticks in QML

    Unsolved
    2
    0 Votes
    2 Posts
    256 Views
    B
    I wonder if there is a bug in Qt. In the debugger I see count go up on candleSeries each time a CandlestickSet is added, but like you I see nothing on the chart. (I am using Qt 5.15 - so this doesn't seem to be an issue with specific versions.)
  • How to select the role of a QSortFilterProxyModel from QML?

    Unsolved qproxymodel role filter
    2
    0 Votes
    2 Posts
    270 Views
    dheerendraD
    Try something like this. Use the data method of index. bool CustomProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { const QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent); // Some how get the the role you require. const QString filterElement = sourceIndex.data(role).toString(); return(filterElement.toLower().startsWith(m_filterText)); }
  • How to use JSONListModel for qml ListView

    Solved
    4
    0 Votes
    4 Posts
    580 Views
    A
    I solved my issue. Here is a more detailed resume of what I did: The problem was that QML_XHR_ALLOW_FILE_READ wasn't set to 1. I received the consol log : Set QML_XHR_ALLOW_FILE_READ to 1 to enable this feature. To avoid this error I have changed my main.py file import os import sys from pathlib import Path from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine from autogen.settings import url, import_paths os.environ["QML_XHR_ALLOW_FILE_READ"] = "1" if __name__ == '__main__': app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() app_dir = Path(__file__).parent.parent engine.addImportPath(os.fspath(app_dir)) for path in import_paths: engine.addImportPath(os.fspath(app_dir / path)) engine.load(os.fspath(app_dir/url)) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec()) Additionally I have added an import to my ui.qml file: import JSONListModel and changed my source input from JSONListModel { id: jsonModel1 source: "jsonData.txt" query: "$.store.book[*]" } to JSONListModel { id: jsonModel1 source: Qt.resolvedUrl("jsonData.txt") query: "$.store.book[*]" } Which finally worked for me.
  • Dynamic CandleStickSeries not working

    Unsolved
    1
    0 Votes
    1 Posts
    90 Views
    No one has replied
  • Can't dynamically update CandlestickSeries in QtCharts

    Unsolved
    5
    0 Votes
    5 Posts
    344 Views
    K
    Did you solve it?
  • 0 Votes
    4 Posts
    456 Views
    L
    Hi @Pl45m4, thanks for the reply. If you know, can you enlighten me on the main question, being why/when to use qt_add_library over just using qt_add_qml_module? Thanks!
  • Dynamically add buttons to a row and change their text

    Moved Solved
    5
    0 Votes
    5 Posts
    513 Views
    A
    Hello guys, I found more information regarding the designer-developer-workflow, which is described in the Qt Design Studio documentation. I have used Qt Design Studio to design my graphical user interface and Qt Creator for the logic. This means that all visual elements are ui.qml files and the logic code can be found in .qml files.
  • programmatically changing contents of Image source

    Solved
    7
    0 Votes
    7 Posts
    451 Views
    SGaistS
    @mzimmers said in programmatically changing contents of Image source: @SGaist It's interesting that you mentioned QQuickImageProvider - I just began using that a couple days ago. I don't see, though, how I can use it to selectively edit the contents of an SVG. You would pass the color you want as parameter to the image provider, and depending on what you need the image size. There you'll modify the svg text as needed and generate the pixmap to return to the QML side.
  • Current Location on map in Android

    Unsolved
    1
    0 Votes
    1 Posts
    103 Views
    No one has replied
  • Three.js support in Qt 6.7 ?

    Unsolved
    3
    0 Votes
    3 Posts
    258 Views
    SGaistS
    Hi, Sorry, I don't however since it seems you have it working on Qt 5, the simplest would be to try writing a minimal test application using it.
  • Replacement of Canvas3D in Qt 6.7 ?

    Unsolved
    3
    0 Votes
    3 Posts
    271 Views
    B
    This is the only discussion I could find: https://lists.qt-project.org/pipermail/development/2018-August/033523.html
  • windeployqt and VectorImage

    Solved
    3
    0 Votes
    3 Posts
    300 Views
    M
    @SGaist Thank you. I did as you said first for some time ago, when I tried msvc kit, and it didn't work, so I searched and found this confusing topic (https://forum.qt.io/topic/73340/windeployqt-and-qml ) and tried pointing to Qt's qmldir. Then I switched to mingw but continued pointing to Qt's qmldir. Anyway, your answer worked with mingw kit, and msvc turned to be impossible to run even from release folder before the deployment, but that's another story. Thank you very much!
  • PushButton icon spacing

    Unsolved
    2
    0 Votes
    2 Posts
    268 Views
    SGaistS
    Hi and welcome to devnet, AFAIK, you can't do it like that. If you want that distance to be different, you will have to implement that yourself. One way is to customize the size handling and paint event. The other is to create an image with a transparent background which provides the extra gap you are after.
  • Failed to import C++ class into QML in Qt6.5

    Solved
    2
    0 Votes
    2 Posts
    200 Views
    T
    Solution: Everything was working correctly except for the import warning in Qt Creator. The issue is related to Qt Creator itself and not the Qt framework. The application runs and works as expected without any issues. This import warning can be safely ignored, as it does not affect the functionality of the application.
  • Problem with virtual keyboard in WASM

    Solved
    4
    0 Votes
    4 Posts
    306 Views
    A
    For other persons, in pro file: static { QT += svg QTPLUGIN += qtvirtualkeyboardplugin } and in main.cpp #include <QtVirtualKeyboard> qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); with this VKB works well
  • QT can't load qml controls

    Solved
    8
    0 Votes
    8 Posts
    645 Views
    F
    Thank you @Bob64 @JoeCFD and @jsulm , I fallback to QT5.x, the program can run again.
  • How to Print a Scrollable Application Window as a Full PDF in Qt

    Unsolved
    1
    0 Votes
    1 Posts
    91 Views
    No one has replied