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
  • Get QtGraphs with XYModelMapper working

    Unsolved
    4
    0 Votes
    4 Posts
    97 Views
    I
    @GrecKo I have an additional question, because it is important for my project: How can I update the axes in the following sense: ValueAxis { id: axisX min: Graphsmodel.returnXmin() max: Graphsmodel.returnXmax() titleText: "X-Achse" } Even with fixed starting values this is not working for me.
  • How to pass `QQuickWheelEvent` to C++?

    Solved
    5
    0 Votes
    5 Posts
    393 Views
    jeremy_kJ
    Hopefully, this will seem obvious in retrospect. Event objects in QML must logically either be special-cased by the engine, or QObject instances with properties accessed via the normal mechanism. A look at some source code suggests the later. As such, event instances can be passed to functions that receive a QObject *. Properties of the object can then be read via QObject::property() or QMetaObject::property().
  • Repeater and Delegate: ctx.fillStyle does not update color on DataChanged

    Solved
    5
    0 Votes
    5 Posts
    143 Views
    I
    @GrecKo I also added some text to the circle.
  • Problem with DoubleSpinBox in TableView

    Unsolved qml tableview doublespinbox
    1
    0 Votes
    1 Posts
    76 Views
    No one has replied
  • QML Profiler Debug connection failed

    Unsolved
    1
    0 Votes
    1 Posts
    78 Views
    No one has replied
  • Tumbler doesn't respond on mouse wheel

    Unsolved
    2
    0 Votes
    2 Posts
    180 Views
    MarkkyboyM
    You should take a look at examples by QT for Tumbler QML; https://doc.qt.io/qt-6/qml-qtquick-controls-tumbler.html Try this, or parts of this code, this works for me; import QtQuick import QtQuick.Controls Window { id: window width: 640 height: 480 visible: true title: qsTr("Mouse wheel action") Rectangle { color: "khaki" anchors.centerIn: parent width: frame.implicitWidth + 10 height: frame.implicitHeight + 10 Frame { id: frame anchors.centerIn: parent Row { id: row Tumbler { id: tumbler model: 5 width: 200; height: width focus: true; wheelEnabled: false delegate: Text { text: modelData font.pixelSize: 18 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter opacity: 1.0 - Math.abs(Tumbler.displacement) / (tumbler.visibleItemCount / 2) required property var modelData required property int index } } WheelHandler { onWheel: (event) => { tumbler.currentIndex += event.angleDelta.y > 0 ? -1 : 1 } } } } } } p.s. My mouse is old and the scroll wheel is very intermittent, but I think the above should help.
  • An Unknown Segfault

    Solved
    7
    0 Votes
    7 Posts
    552 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
    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 } }
  • Create un MapRectangle crossing the antimeridian

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

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

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

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

    Unsolved
    2
    0 Votes
    2 Posts
    150 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
    114 Views
    No one has replied
  • QQuickFramebufferObject::Renderer::render() not even being called

    Solved
    10
    0 Votes
    10 Posts
    834 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
    528 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
    228 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
    618 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
    164 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied