Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.7k Posts
  • Weather data value to rotation

    Solved
    7
    0 Votes
    7 Posts
    441 Views
    MarkkyboyM
    @J-Hilk - sorry, scrap that last comment, I changed it to value and now it works!, yay!!, thank you @J-Hilk, you sir are a genius!! :)
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Error Creating QQuickPaintedIntem

    Unsolved
    2
    0 Votes
    2 Posts
    253 Views
    sierdzioS
    Code looks fine (but when posting on forum, please wrap it with ``` tags). Run it with a debugger, or with address sanitizer, and see where it really crashes. Perhaps you do something wrong in main.cpp?
  • 0 Votes
    10 Posts
    872 Views
    A
    @fcarney yeah, probably would have to just test and measure the performance, which is probably quite a bit of work with unsure result and sadly, I don't have unlimited time.. Meanwhile, I've came up with different approach and even tested it a little and it seems to be working. Not sure how viable it is or what pitfalls it might have though. Basically, I'd change my models into models of QObjects with Q_PROPERTY for every role. Model would function as normal but would have extra functionality - it would be possible to register another QObject of same class as a mirror (each xChanged property signal from source item would be connected to setX signal of the mirror). This mirror QObject would exist in QML and its properties could be used in the same way as model roles. Repeater { model: playerModel delegate: Item { Label { text: "Player name: " + nameRole } PlaylistMirror { id: playlist uuid: playlistUuidRole } Label { text: "Playlist name: " + playlist.name } } This mirror object would register itself to the model whenever its uuid property changed. Something like this (with checks ofc): void register(QUuid uuid, Playlist *mirror) { Playlist * source = find(uuid); connect(source, &Playlist::nameChanged, mirror, &Playlist::setName); mirror->setName(source->name()); // initial sync // same for all roles } It should be safe - if the source object got destroyed by mistake, it would simply stop updating the mirror instead of crashing that would happen if I just got raw pointer from the model. There would have to be some logic for cleaning (if mirror changed the uuid, it would have to disconnect and connect again; if source was deleted, mirror should be cleaned) but otherwise, it seems like decent solution. The performance hit of generating xChanged signals without any receiver should be negligible and there is no need for any extra models or filtering. Higher memory usage is non-issue. Here's diagram for better illustration: [image: 7384b685-a006-435b-be61-fa8afecc899d.png] What do you think?
  • Qt Creator Form Editor no drag & drop possible

    Unsolved
    1
    0 Votes
    1 Posts
    206 Views
    No one has replied
  • showing slider in ComboBox using QML

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    GrecKoG
    You can use the fact that the popup's contentItem of the ComboBox is a ListView and use ScrollBar vertical attached property: Binding { target: comboBox.popup.contentItem.ScrollBar property: "vertical" value: ScrollBar { policy: ScrollBar.AlwaysOn } }
  • 0 Votes
    1 Posts
    501 Views
    No one has replied
  • How to create QVideoFrame from AVFrame from FFmpeg in QT6?

    Unsolved
    3
    0 Votes
    3 Posts
    569 Views
    I
    Thanks, I will try it.
  • How To Play RTP-VideoStreams with QML2 VideoOutput?

    5
    0 Votes
    5 Posts
    7k Views
    M
    on Linux (GStreamer backend) , usually udp should be used to playback the stream
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    46 Views
    No one has replied
  • ListView loaded by Loader directly causes sections to not update when model changed

    Solved
    2
    0 Votes
    2 Posts
    229 Views
    fcarneyF
    https://bugreports.qt.io/browse/QTBUG-103367
  • MediaPlayer starts playback with wrong volume

    Unsolved
    1
    0 Votes
    1 Posts
    193 Views
    No one has replied
  • Import causes QML Item to not load

    Unsolved
    2
    0 Votes
    2 Posts
    323 Views
    GrecKoG
    Try running your application with the QML_IMPORT_TRACE set to 1 and look at the messages in the console.
  • Two cursors occurs, with qt5.15.2 eglfs

    Unsolved
    4
    0 Votes
    4 Posts
    406 Views
    SGaistS
    That's normal. You had two applications fighting for the same resources (your application and the X server).
  • How do I find out values for QML enumerations in docs?

    Unsolved
    2
    0 Votes
    2 Posts
    160 Views
    L
    They should refer to the Qt AlignmentFlag enum. Therefore, you should be able to do something like this: Q_PROPERTY(int hAlign READ getHorizontalAlignment NOTIFY objectChanged) Q_PROPERTY(int vAlign READ getVerticalAlignment NOTIFY objectChanged) int MyClass::getHorizontalAlignment() { return Qt::AlignHCenter; } int MyClass::getVerticalAlignment() { return Qt::AlignBottom; } TextEdit { anchors.fill: parent text: "Hello World" horizontalAlignment: MyContextPropertyOrModel.hAlign verticalAlignment: MyContextPropertyOrModel.vAlign }
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • how to call windows 10 calculator in qml?

    Unsolved
    3
    0 Votes
    3 Posts
    252 Views
    P
    I got it, thanks
  • Whats up with shadowing in qt 6?

    Unsolved
    1
    0 Votes
    1 Posts
    155 Views
    No one has replied
  • How to scale an item in a specific area?

    Unsolved
    1
    0 Votes
    1 Posts
    200 Views
    No one has replied
  • 0 Votes
    2 Posts
    173 Views
    M
    Ok I think i have got it. The following did the trick. I added anchors.fill in Sandbox.qml root item. I removed the code for view3d render mode setting from the main.qml into the sandbox.qml file so the Component.onCompleted just does this Component.onCompleted: { dynamicallyCreatedItem = Qt.createComponent('qrc:/Sandbox.qml').createObject(window, {value1: 0.5, value2:0.5, value3:0.5, value4:0.5, value5:0.5, value6:0.5, isEnabled1: false, isEnabled2: false, isEnabled3: false}) toptitle.text = dynamicallyCreatedItem.sessionText } Doing this works fine and I get the two viewports as in original code. The issue is solved. The github repo contains the correct code for anyone who is stuck.