Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.3k Topics 78.3k Posts
Qt 6.11 is out! See what's new in the release blog
  • An Unknown Segfault

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    A
    Post is updated. Upgrade to Qt 6.11.1 probably did the magic
  • Instanting Q_GADGET

    Unsolved qtquick c++
    3
    0 Votes
    3 Posts
    4k Views
    D
    C++: class MyValueType { Q_GADGET QML_VALUE_TYPE(myValueType) QML_CONSTRUCTIBLE_VALUE public: Q_INVOKABLE MyValueType(double d = 0.0); // ... }; QML: import MyModule as MM QtObject { function process(d: real) { let v = new MM.myValueType(d); // v is a myValueType now } }
  • Create un MapRectangle crossing the antimeridian

    Unsolved
    1
    1 Votes
    1 Posts
    302 Views
    No one has replied
  • MapQuickItem + MapboxGl ignores item stack ordering

    Unsolved
    1
    0 Votes
    1 Posts
    329 Views
    No one has replied
  • Android Keyboard AdjustPan gap between kbd and TextEdit

    Unsolved
    1
    0 Votes
    1 Posts
    245 Views
    No one has replied
  • QQmlEngine::setExternalSingletonInstance

    Unsolved
    1
    2 Votes
    1 Posts
    243 Views
    No one has replied
  • How can i set default TextField Border with current Style

    Unsolved
    2
    0 Votes
    2 Posts
    349 Views
    P
    I have also tried taking the implementation directly from the TextField.qml file from the Material Style which results in this behaviour: As you can see it is always visible and doesnt "make space" for the placeholder Text. [image: b2db065a-f2c8-4034-ae8d-79309d4fc7b3.png] Component { id: enabledBackground MaterialTextContainer { implicitWidth: 120 implicitHeight: control.Material.textFieldHeight filled: control.Material.containerStyle === Material.Filled fillColor: control.Material.textFieldFilledContainerColor outlineColor: (enabled && control.hovered) ? control.Material.primaryTextColor : control.Material.hintTextColor focusedOutlineColor: control.Material.accentColor placeholderTextWidth: Math.min(placeholder.width, placeholder.implicitWidth) * placeholder.scale placeholderTextHAlign: control.effectiveHorizontalAlignment controlHasActiveFocus: control.activeFocus controlHasText: control.length > 0 placeholderHasText: placeholder.text.length > 0 horizontalPadding: control.Material.textFieldHorizontalPadding } }
  • QQuickFramebufferObject::Renderer::render() not even being called

    Solved
    10
    0 Votes
    10 Posts
    2k Views
    SGaistS
    Where are you trying to get these events in your project ?
  • 2200% CPU Usage from processed camera feed implementation

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    O
    @Ronel_qtmaster @GrecKo Thank you both for the suggestions — I'll work through them and report back. Unfortunately I can't share much code as I initially said due to project confidentiality, but here's as much context as I can give (feel free to ask for more if there's any confusion): Architecture overview: The backend runs a ROS2 classification node using Ultralytics YOLOv8 + PyTorch. This is understandably CPU-heavy. My GUI class subscribes to a ROS topic that fires a signal each time the classification of one frame completes. A camera bridge class is connected to the GUI class and forwards frames to QML. The QML GUI itself runs as a dedicated ROS2 node, launched inside a QThread. Comparison with the old Widget-based GUI: The previous implementation used QPixmap inside a standard Qt Widgets GUI. It worked — the FPS dropped from ~30 to ~10 due to the ML overhead, but it was fully usable. My QML implementation is significantly worse: ~1 FPS with a ~20-second rendering delay, making camera control completely unusable. Since the backend is identical in both cases, the bottleneck must be in how I'm bridging frames from the ROS2 subscription into QML. Potential issue I'm investigating: I suspect the QML rendering pipeline is either blocking on frame delivery, accumulating a backlog of unprocessed frames, or doing unnecessary work on the UI thread — but I haven't pinpointed it yet. Could there be a potential fault in how I configure the main.cpp file? I've provided the core logic from my implementation below. int main( argc, *argv[]) { qputenv("QSG_RENDER_LOOP", "thread"); //tried to use basic, virtually no difference rclcpp::init(argc, argv); qRegisterMetaType<QImage>("QImage") ..... QApplication app(argc, argv); ..... QNode qnode; if (!qnode.init()) return -1; ....//Initializing camera auto cameraProvider = new CameraBridge(); engine.rootContext()->setContextProperty("cameraBridge", cameraProvider) ...... engine.load(url); if (engine.rootObjects().isEmpty()) return -1; int result = app.exec(); rclcpp::shutdown(); qnode.wait(); return result; } @Ronel_qtmaster — I tried applying your suggestion to my paint function but didn't see an improvement. It's possible I'm not applying it at the right point in the pipeline, but I belive my implementation is correct. @GrecKo — I'll implement your approach and report back today or tomorrow. Fallback plan: If I can't resolve this in QML, I may try embedding the old QPixmap-based camera widget into my QML app using QQuickWidget or similar. I know mixing Widgets and QML is generally discouraged in that direction, but it may be the pragmatic solution here. Any experience or tips with that approach would be welcomed.
  • Call function from ancestor. How?

    Unsolved
    2
    0 Votes
    2 Posts
    377 Views
    GrecKoG
    The usual way to do this is to declare a signal in the root of your Template and then connect to it when using the type. So in Template.qml: Rectangle { id: oRoot signal clicked() // ... MouseArea { onClicked: oRoot.clicked() // ... And then in ComponentBasedOnTemplate.qml: Template { onClicked: console.debug( "Component onClicked") } I'll advise you to just use Button or another higher level type provided by Qt Quick Controls though.
  • Qt Quick2

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    Z
    @Christian-Ehrlicher Thank you all for your support and assistance. Eventually, I discovered the solution. Originally, it was necessary to add the resource files in the "qt_add_executable" section of the CMakeList file, and set CMAKE_AUTORCC to ON. Although the images couldn't be seen in the QML Designer of Qt Creator, they were displayed perfectly on the Android emulator.
  • Qt6.2.4 Text Cursor Display Issue

    Unsolved
    1
    0 Votes
    1 Posts
    278 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Qml video metaData returns undefined values

    Unsolved
    2
    0 Votes
    2 Posts
    600 Views
    G
    Hello, Though it's a later response, you can try: console.log(video.metaData.value(key)). The key is a fixed number which indicates the metaData keys,like: video.metaData.value(0) //title video.metaData.value(0) //duration etc. When you load a media, the keys will be in array but in random order, you can run console.log(video.metaData.keys()) to get the keys first. I'm not a programmer, so I'm not so surre about if it's the best way to read the MetaData, but it works on Qt6.10
  • Custom TitleBar

    Unsolved custom titlebar framelesswindow frameless bar titlebar
    4
    0 Votes
    4 Posts
    2k Views
    C
    https://github.com/stdware/qwindowkit This is currently the best frameless window lib. It is cross-platform and supports both QWidget and QQuick.
  • 0 Votes
    3 Posts
    1k Views
    SGaistS
    Hi and welcome to devnet, From a quick check, they look pretty neat ! One thing that I would suggest is to translate the comment in the code to English. You'll will reach a wider audience that way.
  • Qt workflow issues: static positioning instead of layouts / anchors

    Unsolved
    3
    1 Votes
    3 Posts
    602 Views
    KH-219DesignK
    I do software consulting on various projects, and I personally have written QML by hand while "copying" (the look) from a given Figma project that was handed off to me. I have never used the Figma Qt plugin. FWIW, I have had two different UX designers (experts at Figma) on two different projects comment to me that they gave up on trying to use the Figma Qt plugin (and hence they reverted to writing the QML by hand). Nonetheless, I am now subscribed to this thread because I, too, would love to hear anyone's positive experience or any expert tips that could make it worthwhile to use the plugin.
  • qmlls auto complete

    Unsolved
    2
    0 Votes
    2 Posts
    394 Views
    JKSHJ
    @Redman My guess is that qmlls can't find the registration details for your "baseclass". Can you provide a reproducer?
  • Improving 3D Robot Visualization in Qt Quick 3D – Should I Use OCCT?

    Unsolved
    2
    0 Votes
    2 Posts
    575 Views
    J
    I'm not exactly sure what visuals you are going for, but to get it looking like in the picture you might want to look into using a CustomMaterial with cel shading.
  • 0 Votes
    2 Posts
    598 Views
    J
    There are two main ways of loading meshes in QQ3D, either using balsam https://doc.qt.io/qt-6/qtquick3d-tool-balsam.html or using RuntimeLoader https://doc.qt.io/qt-6/qml-qtquick3d-assetutils-runtimeloader.html. You can also create a custom geometry loader https://doc.qt.io/qt-6/qquick3dgeometry.html but this only provides geometry and not materials or textures.