Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
19.8k Topics 76.6k Posts
  • QML Drag and Drop including reordering the C++ model

    Unsolved
    2
    0 Votes
    2 Posts
    74 Views
    M

    Here is a link to the full code: https://mega.nz/file/XQlQECqa#LxhaaqWAmvVyTEFLd3MtnMCnRcmU9glXgZWYC6yyrv4
    Based on the article: https://raymii.org/s/tutorials/Qml_Drag_and_Drop_example_including_reordering_the_Cpp_Model.html

  • 0 Votes
    2 Posts
    181 Views
    C

    I have the exact same issue. Were you able to fix it?

  • Why does `required` change the value of a property?

    Solved
    3
    0 Votes
    3 Posts
    83 Views
    GrecKoG

    and do fix it you should do:

    delegate: MyItem { required property var model mdl: model }

    (or rename mdl to model in MyItem.qml)

  • QtQuick.VectorImage is not installed

    Unsolved
    1
    0 Votes
    1 Posts
    33 Views
    No one has replied
  • View3D

    Unsolved
    1
    0 Votes
    1 Posts
    35 Views
    No one has replied
  • 1 Votes
    16 Posts
    433 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
    514 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
    70 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.)

  • 0 Votes
    2 Posts
    110 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
    320 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.

  • QML Mouse drag laggy

    Unsolved
    5
    0 Votes
    5 Posts
    233 Views
    S

    @GrecKo ... actually its the default VSYNC Setting of QML as i figured that increases the latency by ALOT! So for anyone searching just disable VSYNC an manage it yourself.

    Still a shame that i had to search multiple days to find a good solution. Should be better documented. Actually i do have 120hz...

  • Dynamic CandleStickSeries not working

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

    Unsolved
    5
    0 Votes
    5 Posts
    153 Views
    K

    Did you solve it?

  • 0 Votes
    4 Posts
    141 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
    223 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.

  • Custom ComboBox not scrolling

    Unsolved
    1
    0 Votes
    1 Posts
    41 Views
    No one has replied
  • Cannot clear selection in GridView/ListView

    Unsolved
    1
    0 Votes
    1 Posts
    52 Views
    No one has replied
  • programmatically changing contents of Image source

    Solved
    7
    0 Votes
    7 Posts
    191 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
    38 Views
    No one has replied
  • Three.js support in Qt 6.7 ?

    Unsolved
    3
    0 Votes
    3 Posts
    99 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.