Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • Howto setup qml android 16kb Pages

    Unsolved
    5
    0 Votes
    5 Posts
    51 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
    39 Views
    No one has replied
  • How to expose a normal function to QML?

    Unsolved
    10
    0 Votes
    10 Posts
    108 Views
    JKSHJ
    @Saviz said in How to expose a normal function to QML?: Before I commit to writing hundreds of thin wrapper classes, is there a way to call plain, non-class member C functions directly from QML? (These functions aren’t attached to any class.) As others have pointed out, at least one class with Q_OBJECT or Q_GADGET is required. You don't need hundreds of classes. You just need one class to hold your many methods/functions (or perhaps a few classes, if you want to organize/group your functions) 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. If you do want to expose hundreds of C functions directly to QML, then it could make sense to write a wrapper script to read your C header and generate the corresponding wrapper C++ method.
  • Map - api key requared

    Solved
    4
    0 Votes
    4 Posts
    789 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) } } }
  • Dialog modality ignored

    Unsolved
    3
    0 Votes
    3 Posts
    41 Views
    V
    @jeremy_k Thanks for testing. I'm considering opening a ticket, though I would appreciate if someone can test this on Windows before I do, such that I'm not doing something obviously silly or plain wrong.
  • qt_add_qml_module with absolute QML file paths causes qmlcachegen error

    Unsolved
    3
    0 Votes
    3 Posts
    60 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
    1k 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
    68 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
    35 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
    78 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
    80 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];
  • No QML Variables and expression inspection for MinGW-LLVM ?

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    mzimmersM
    I just tested - it does indeed produce QML console messages. (The output is kind of smashed together, but the content is there.) [image: b7a1823a-dccf-4ead-931f-d2d47df98bf3.png] Thanks for pointing this out, @cristian-adam .
  • Best Approach for Displaying Multiple Camera Streams in Qt 6.9.1 with Microservices

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    Ronel_qtmasterR
    @greed_14 Yes. exactly. I have a thread class that gets the streamed image in realtime and send it to the UI. I do not do any copy of the images, as it consumes a lot of memory. I am using ffmpeg for frame streaming and opencv for object detection. For QML it is the same approach. So, each streaming contains a thread for getting streamed images, an image processing alogirithm and memory allocation feature. You should also consider how to run the program on GPU or loading those image in the GPU
  • QSyntaxHighlighter with TextEdit, format is not reflecting in TextEdit qml.

    Unsolved
    1
    0 Votes
    1 Posts
    220 Views
    No one has replied
  • Absolute QML newbie lost on alignment on anchors

    Solved
    8
    0 Votes
    8 Posts
    2k Views
    JKSHJ
    You're welcome! Thank you for sharing your journey and your solution. Here are some additional tidbits that might be of interest to you: Anchor default values Items are always placed at their parent's top-left by default. So, you can omit these lines and still get the same result: anchors.top: parent.top anchors.left: parent.left Having said that, you can also keep them for clarity. Label vs. Text Displaying text inside a coloured rectangle is a very common requirement. You can simplify your code by using Label instead (https://doc.qt.io/qt-6/qml-qtquick-controls-label.html ). Add import QtQuick.Controls.Basic and try the following: Label { id: name background: Rectangle { color: "blue" } text: myContactInfo.name font.pointSize: 30 } Label { id: address anchors.top: name.bottom background: Rectangle { color: "green" } text: myContactInfo.address font.pointSize: 15 } Note: One difference is that Label might change your font colour based on your OS settings (e.g. dark mode) Positioners vs. Anchors See https://doc.qt.io/qt-6/qtquick-positioning-layouts.html -- instead of anchoring your 2nd label to the 1st label, you could put them inside a Column: Column { // Quiz (open-book): What is the width and height of this Column? Label { id: name background: Rectangle { color: "blue" } text: myContactInfo.name font.pointSize: 30 } Label { id: address background: Rectangle { color: "green" } text: myContactInfo.address font.pointSize: 15 } }
  • How to implement multiple actions on onClicked [SOLVED]

    Solved mousearea qml signal
    7
    1 Votes
    7 Posts
    6k Views
    SGaistS
    @RokeJulianLockhart hi, This thread is 10 years old and was created with the previous version of the forum software where there was no concept yet of "solved state" hence the [solved] in the title which was how threads were marked at that time. [edit: fixed the resolution]
  • 0 Votes
    11 Posts
    4k Views
    JKSHJ
    @RokeJulianLockhart said in plugin cannot be loaded for module "QtQuick.Layouts": Cannot protect module QtQuick.Layouts 2 as it was never registered QML debugging is enabled...: qml-qt6 ./main.qml works perfectly Great! Thanks for sharing. Just remember that you are bound to your distro's version of Qt 6, so the qml-qt6 tool won't be able to process QML code that uses functionality from newer versions. The tool is also intended as a way to quickly preview *.qml files. It won't be able to handle custom types/classes defined from C++ or Python for example (unless you put your class in a C++ plugin that's formally installed)
  • kde integration

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    RokeJulianLockhartR
    I thought seetings "Breeze" would change QQuickControls aspect but I think I'm wrong. @Jim-Gir, yeah: print( "Current QQuickStyle: ", PySide6.QtQuickControls2.QQuickStyle.name() ) PySide6.QtQuickControls2.QQuickStyle.setStyle("Breeze") print( "Current QQuickStyle: ", PySide6.QtQuickControls2.QQuickStyle.name() ) ...returns "Fusion", then "Breeze", yet the controls appear identical regardless, despite them being quite different styles: Fusion Breeze [image: 441c28d5-597c-45c4-abce-c2b44c341273.png] [image: 057417eb-1519-4126-88fb-290f22823792.png] Perhaps, ask at discuss.kde.org/t/1240, or a new thread on that instance? Environment Operating System: Fedora Linux 42 KDE Plasma Version: 6.4.4 KDE Frameworks Version: 6.17.0 Qt Version: 6.9.1 Kernel Version: 6.15.9-201.fc42.x86_64 (64-bit) Graphics Platform: Wayland
  • How to add icon to button?

    Solved
    10
    1 Votes
    10 Posts
    13k Views
    RokeJulianLockhartR
    You can simply set iconName to the the name the icon has in the theme and use iconSource as a fallback. Can anyone provide an example for this? I also want to utilise the system icons, if possible.