Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • Get all enum value names from C++ enum definition

    Solved
    4
    0 Votes
    4 Posts
    128 Views
    SebastianMS
    Partial solution which I found is to register this enum C++ class as creatable. Then in point where I need value names - is to call is JS section var obj = Qt.createQmlObject('import InfModule1.0; BackgroundType {}', parent); obj.names();
  • 0 Votes
    2 Posts
    50 Views
    Aleksey_KA
    ✅ Solution: Force layout recalculation after width changes To ensure layout syncs correctly, you need to explicitly trigger layout updates when the TableView or HorizontalHeaderView resizes. Fix: Add onWidthChanged: tableView.forceLayout() in both the TableView and the HorizontalHeaderView. 🔧 Updated code: TableView { id: tableView columnWidthProvider: function (column) { // Your width logic } onWidthChanged: tableView.forceLayout() } HorizontalHeaderView { id: header syncView: tableView onWidthChanged: tableView.forceLayout() } ✅ Even in HorizontalHeaderView, you call **tableView.forceLayout()**, not header.forceLayout(). 🧠 Why this works columnWidthProvider often runs before tableView.width is fully initialized or updated. forceLayout() triggers Qt to re-run layout and width calculations with correct sizing. syncView can now properly sync header and table widths based on the final layout pass. ✅ Result Now the header and table stay in perfect sync, even when: Resizing the window Stretching a specific column to take remaining space Changing content dynamically
  • QSyntaxHighlighter with TextEdit, format is not reflecting in TextEdit qml.

    Unsolved
    2
    0 Votes
    2 Posts
    331 Views
    SGaistS
    Hi, Which version of Qt are you using ? On which OS ? I tested your code on macOS with 6.7.2 and it's working properly.
  • Dialog modality ignored

    Unsolved
    4
    0 Votes
    4 Posts
    194 Views
    T
    Same thing happens for me with Qt 6.9.2 on Windows Enterprise 10.0.26100. Both Qt.WindowModal and Qt.ApplicationModal are ignored. The Dialog from QtQuick.Controls with modal: true works as expected
  • How to expose a normal function to QML?

    11
    0 Votes
    11 Posts
    296 Views
    SavizS
    @JKSH said in How to expose a normal function to QML?: Do you need to expose every single C function directly to your GUI? Perhaps you could design your wrapper class as an abstraction layer that exposes fewer but higher-level methods to QML, while these higher-level functions each call multiple lower-level C functions. You are absolutely right that not all functions need to be exposed to the GUI layer. However, there are still a significant number of functions that do need to be invoked directly from the GUI. For that reason, I believe your proposed solution of creating a controller or wrapper unit with automated C++ generation is indeed the best approach. That said, I’ll continue researching to see if there are any alternative technologies that might be a better fit for my situation.
  • AM62x/Qt app renders fine after fresh flash, breaks after later redeploys

    Moved Unsolved
    4
    0 Votes
    4 Posts
    112 Views
    N
    Hi @JKSH ,It works for me. I disabled the pipeline cache by adding: QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache); to main.cpp.
  • Application AbracaDABra cmake brings up tons QML-errors

    Unsolved
    1
    0 Votes
    1 Posts
    97 Views
    No one has replied
  • DelegateModel DelegateModelGroup under the hood

    Unsolved
    1
    0 Votes
    1 Posts
    36 Views
    No one has replied
  • Best Approach for Displaying Multiple Camera Streams in Qt 6.9.1 with Microservices

    Unsolved
    11
    0 Votes
    11 Posts
    2k Views
    G
    @Ronel_qtmaster Yes currently we are trying to use gpu and reduce the cpu load Below is the gstreamer pipeline i'm trying by using d3d11 QString( "rtspsrc location=%1 latency=0 protocols=tcp name=src " "src. ! rtph264depay ! h264parse ! tee name=t " "t. ! queue ! d3d11h264dec ! d3d11convert ! d3d11download " "! video/x-raw,format=RGB " "! appsink name=appsink emit-signals=true sync=false max-buffers=2 drop=true" ) and we are encoding and decoding to jpeg using turbojpeg library. Do you have any suggestions on using gpu or gstreamer pipeline We are also thinking of trying to send the h264 encoded data and stream that also.
  • This topic is deleted!

    Unsolved
    0
    0 Votes
    0 Posts
    1 Views
    No one has replied
  • Howto setup qml android 16kb Pages

    Unsolved
    5
    0 Votes
    5 Posts
    179 Views
    P
    Not any good answers at the moment, I can build but have errors when deploy on 16k simulator: E/AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread E/AndroidRuntime: Process: myapp, PID: 17722 E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/~~B4A7JRzPoDAUFkL5m18Emw==/myapp-TdQiYjEN3sCGcg21EqbwmA==/base.apk!/lib/x86_64/libavformat.so" failed to setup 16KiB App Compat E/AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1090) E/AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1012) E/AndroidRuntime: at java.lang.System.loadLibrary(System.java:1765) E/AndroidRuntime: at org.qtproject.qt.android.QtLoader.loadLibraryHelper(QtLoader.java:486) E/AndroidRuntime: at org.qtproject.qt.android.QtLoader.lambda$loadLibraries$1$org-qtproject-qt-android-QtLoader(QtLoader.java:562) E/AndroidRuntime: at org.qtproject.qt.android.QtLoader$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0) E/AndroidRuntime: at org.qtproject.qt.android.QtThread.lambda$run$0(QtThread.java:57) E/AndroidRuntime: at org.qtproject.qt.android.QtThread$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0) E/AndroidRuntime: at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25) E/AndroidRuntime: at java.lang.Thread.run(Thread.java:1119)
  • App UI is freezing after returning from Windows Lock screen.

    Unsolved
    1
    1 Votes
    1 Posts
    76 Views
    No one has replied
  • Map - api key requared

    Solved
    4
    0 Votes
    4 Posts
    913 Views
    JoeCFDJ
    The code in the video does not work. Not sure how he made the video. The tile address was typed to tite wrongly and the format was not correct either. The following code works for Qt5&6 QML without marker "API Key required". import QtQuick //2.15 for Qt5 import QtLocation //5.15 for Qt5 import QtPositioning //5.15 for Qt5 Window { width: Qt.platform.os == "android" ? Screen.width : 512 height: Qt.platform.os == "android" ? Screen.height : 512 visible: true title: map.center + " zoom " + map.zoomLevel.toFixed(3) + " min " + map.minimumZoomLevel + " max " + map.maximumZoomLevel Plugin { id: mapPlugin name: "osm" PluginParameter { name: "osm.mapping.providersrepository.disabled" value: true //fpr Qt5 value: "true" } PluginParameter { name: "osm.mapping.custom.host" value: "https://tile.openstreetmap.org/%z/%x/%y.png" } } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(59.91, 10.75) // Oslo zoomLevel: 14 activeMapType: map.supportedMapTypes[map.supportedMapTypes.length - 1] property geoCoordinate startCentroid PinchHandler { id: pinch target: null onActiveChanged: if (active) { map.startCentroid = map.toCoordinate(pinch.centroid.position, false) } onScaleChanged: (delta) => { map.zoomLevel += Math.log2(delta) map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position) } onRotationChanged: (delta) => { map.bearing -= delta map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position) } grabPermissions: PointerHandler.TakeOverForbidden } WheelHandler { id: wheel // workaround for QTBUG-87646 / QTBUG-112394 / QTBUG-112432: // Magic Mouse pretends to be a trackpad but doesn't work with PinchHandler // and we don't yet distinguish mice and trackpads on Wayland either acceptedDevices: Qt.platform.pluginName === "cocoa" || Qt.platform.pluginName === "wayland" ? PointerDevice.Mouse | PointerDevice.TouchPad : PointerDevice.Mouse rotationScale: 1/120 property: "zoomLevel" } DragHandler { id: drag target: null onTranslationChanged: (delta) => map.pan(-delta.x, -delta.y) } Shortcut { enabled: map.zoomLevel < map.maximumZoomLevel sequence: StandardKey.ZoomIn onActivated: map.zoomLevel = Math.round(map.zoomLevel + 1) } Shortcut { enabled: map.zoomLevel > map.minimumZoomLevel sequence: StandardKey.ZoomOut onActivated: map.zoomLevel = Math.round(map.zoomLevel - 1) } } }
  • qt_add_qml_module with absolute QML file paths causes qmlcachegen error

    Unsolved
    3
    0 Votes
    3 Posts
    159 Views
    L
    @JKSH said in qt_add_qml_module with absolute QML file paths causes qmlcachegen error: The expectation is to have a CMakeLists.txt file in the same folder as your *.qml files. You can then link that folder to the rest of your project using add_subdirectory(). Thank you. This approach is correct. Placing the *.qml files in the src directory is indeed more appropriate. I just wanted to see how to write the CMake configuration when separating QML and C++ code.
  • How I Can Use MapView + ScrollView

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    mzimmersM
    I rewrote your pseudocode into a working example: import QtQuick import QtQuick.Controls import QtQuick.Layouts import QtLocation import QtPositioning Window { id: mainWindow width: 1024 height: 768 visible: true Plugin { id: mapPlugin name: "osm" } MapView { id: mapView anchors.fill: parent map.plugin: mapPlugin; map.center: QtPositioning.coordinate(36.5725, -121.9486); map.zoomLevel: 15; } Flickable { id: flickable width: parent.width height: 200 anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom anchors.leftMargin: 5 anchors.bottomMargin: 5 contentWidth: rowLayout.implicitWidth clip: true z: 1 RowLayout { id: rowLayout Repeater { model: 10 delegate: Rectangle { implicitWidth: 200 height: 300 color: "red" } } } } } A few points: I had to replace the ScrollView with a Flickable the Flickable is a sibling of the MapView, not a child. I gave the Flickable a z: 1. It seems to work pretty well for me. There's a bit of quirk, though: if you try to drag the Flickable beyond its boundary, you end up scrolling the map underneath. Whether this is a bug or a feature is a matter of opinion. There are workarounds for this (using a MouseArea, for example) if you don't like it.
  • XmlListModel Retrive content:encoded data

    Unsolved
    3
    0 Votes
    3 Posts
    164 Views
    O
    @JonB said in XmlListModel Retrive content:encoded data: Is content:encoded an encoded element in a content namespace, or is it something you made up? Assuming the former, don't you have to do something like pass the content separately as a namespace from the encoded as an element name in whatever you do, such as reading it? I know nothing about QML, only XML. Yes, content:encoded is a content element. From what I've researched, in Qt 5, we could achieve this with namespaces, but I believe namespaces have been removed in Qt 6.
  • Creator: How to open analysis results in their own window?

    Unsolved
    1
    0 Votes
    1 Posts
    67 Views
    No one has replied
  • Observed UI flickering on ARM target

    Solved
    16
    0 Votes
    16 Posts
    3k Views
    SGaistS
    @PrajwalG99 hi and welcome to devnet, Might be a silly question but why not use the Qt 6 version that comes with your distribution ?
  • Qt Graphs lacking functionalities - Axes range

    Unsolved
    2
    0 Votes
    2 Posts
    162 Views
    B
    Based on what I have seen, I couldn't recommend using Graphs yet. We had Qt reps at our company plugging Graphs and giving us presentations about it but it turns out that there a number of essential aspects of our current Charts usage that simply aren't supported by Graphs yet. It seems to be a work in progress at the moment. Charts may no longer be being actively developed but it is going to be around for a while yet.
  • 1 Votes
    2 Posts
    127 Views
    T
    adding this code solves the problem for IOS AVAudioSession *session = [AVAudioSession sharedInstance]; NSError *err = nil; [session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:(AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionAllowBluetoothA2DP) error:&err]; [session setMode:AVAudioSessionModeSpokenAudio error:&err]; [session setPreferredSampleRate:48000 error:&err]; [session setPreferredIOBufferDuration:0.01 error:&err]; [session setActive:YES error:&err];