Skip to content

QML and Qt Quick

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

    Unsolved qtquick c++
    3
    0 Votes
    3 Posts
    3k 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 } }
  • Tumbler doesn't respond on mouse wheel

    Unsolved
    1
    0 Votes
    1 Posts
    39 Views
    No one has replied
  • An Unknown Segfault

    Unsolved
    1
    0 Votes
    1 Posts
    43 Views
    No one has replied
  • Create un MapRectangle crossing the antimeridian

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

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

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

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

    Unsolved
    2
    0 Votes
    2 Posts
    64 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 } }
  • QML Local Directory Imports will be undefined after an uncertain amount of time

    Unsolved
    1
    0 Votes
    1 Posts
    83 Views
    No one has replied
  • How to pass `QQuickWheelEvent` to C++?

    Solved
    4
    0 Votes
    4 Posts
    216 Views
    SGaistS
    Hi, One thing you could do is create a small wrapper class so you don't have a big function signature.
  • QQuickFramebufferObject::Renderer::render() not even being called

    Solved
    10
    0 Votes
    10 Posts
    535 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
    348 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
    155 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
    406 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
    120 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
    336 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 TextArea with visible text outside. How?

    Unsolved
    1
    0 Votes
    1 Posts
    125 Views
    No one has replied
  • Custom TitleBar

    Unsolved custom titlebar framelesswindow frameless bar titlebar
    4
    0 Votes
    4 Posts
    415 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
    365 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.