Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.2k Posts
  • windows title bar native

    Unsolved 29 May 2025, 10:18
    0 Votes
    1 Posts
    138 Views
    No one has replied
  • Why radius no effect when clip: true for Rectangle

    Unsolved 27 May 2025, 09:54
    0 Votes
    4 Posts
    464 Views
    Thank you Vitalii777 and SuhasKrishanamurthy for your help. Much appreciated! The code above working good.
  • Correct way to make QML modules Qt 6.5-6.9

    Solved 6 May 2025, 07:03
    1 Votes
    18 Posts
    2k Views
    @JKSH Thanks for the answers!
  • 0 Votes
    3 Posts
    928 Views
    @Dika The solution is to: Register your class using QML_SINGLETON Do not call qmlRegisterSingletonType<>() If you don't have (or don't want) a default constructor, implement a static member function called create() to act as a factory. See https://doc.qt.io/qt-6/qqmlintegration-h-qtqml-proxy.html#QML_SINGLETON for an example
  • module "QtQuick.Controls" version 1.4 is not installed

    Unsolved 26 May 2025, 13:55
    0 Votes
    5 Posts
    503 Views
    It looks like it won't be possible to rebuild the old project without migrating the code to Qt 6...(
  • 0 Votes
    10 Posts
    1k Views
    @StudentScripter said in Feedback needed: QML is this the right way to link other QML Files?: removing RESOURCE_PREFIX / is no problem, works still fine, thanks. :D Good to hear, that's what I expected :) There were some changes in Qt 6.5 to make things easier, so you should no longer need to specify RESOURCE_PREFIX unless you want some unconventional structure (which is not recommended) However do you mean changing all mymodules mentions to mymodulesplugin or only this one? I meant only one: target_link_libraries(appQmlLibraryTest PRIVATE Qt6::Quick mymodulesplugin # <-- Like this ) Cause when changing only one it gives me errors. Can you please share the full error message? Without it, it makes it hard to troubleshoot for you. @StudentScripter said in Feedback needed: QML is this the right way to link other QML Files?: Also another question what to do if i wanted to add another subfolder inside my mymodules/ directory? Lets say: mymodules/extras You could create a new QML module (in mymodules/extras/CMakeLists.txt)
  • 0 Votes
    1 Posts
    135 Views
    No one has replied
  • Qt6 color SVG using MultiEffect

    Solved 2 Apr 2023, 19:25
    0 Votes
    14 Posts
    4k Views
    @MattP2 I don't see how this works. Depending on your input/original color you will get a different gray value in the computation: color.rgb += brightness * color.a; float gray = dot(color.rgb, vec3(0.299, 0.587, 0.114)); Then this gray value will affect to colorizationColor in: color.rgb = mix(color.rgb, gray * colorizationColor.rgb, colorizationAlpha); So even if colorizationAlpha is 1.0, the gray affects the output. It would work, if color was clamped to (1,1,1) after applyiing the brightness, but that doesn't seem to happen. I always get my colorizationColor scaled in the result, even with brightness: 1.
  • 0 Votes
    4 Posts
    349 Views
    What exactly are you trying to achieve ?
  • 0 Votes
    2 Posts
    2k Views
    I have the same problem in 2025. Did you find a solution?
  • Prevent resize and flicker when showing a window

    Unsolved 20 May 2025, 02:02
    0 Votes
    4 Posts
    354 Views
    The layout only finalizes after the window is part of the scene graph, so showing it immediately causes visible resizing. Instead, set the QQuickView visibility to hidden or move it off-screen first. After creating and adding the QML component, wait for implicitWidth and implicitHeight to be valid (you can use a short QTimer::singleShot ). Then resize the window and show it—this way, the user only sees the final, correct size.
  • Table selection not working

    Unsolved 20 May 2025, 16:17
    0 Votes
    3 Posts
    299 Views
    @jhayar Thank you, that makes sense. But ItemSelectionModel.Select doesn't work either. So I'm not sure what you are supposed to use there. Update: I figured out what the problem was. The standard practice is to use a bitwise or with SelectionModel objects. Also I got the index line wrong from the start. The below works: tableView.selectionModel.select( tableView.model.index(row, 0), ItemSelectionModel.Toggle | ItemSelectionModel.Rows) And now I have found out that selections made this way don't survive the filter proxy so I need to do my own logic anyway. Thanks for the learning.
  • 0 Votes
    1 Posts
    132 Views
    No one has replied
  • 0 Votes
    1 Posts
    118 Views
    No one has replied
  • ListView with Flow layout

    Unsolved qml listview layout 20 May 2025, 01:06
    0 Votes
    3 Posts
    304 Views
    @SuhasKrishanamurthy, thanks for your help, but the GridView component has fixed cell's width and height. Items' height can grow up, but if it will be greater than cell's size, the collision occures. If I adjusted GridView's cell size depending on size of largest item, there were too much free space between small items. The following code lays items out with collision: GridView { id: gridView width: 600 height: 400 cellWidth: 200 cellHeight: 100 flow: GridView.FlowTopToBottom model: ListModel { ListElement { value: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" } ListElement { value: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } ListElement { value: "Lorem ipsum dolor sit amet" } } // orientation: Qt.Horizontal // GridView doesn't have this property boundsBehavior: Flickable.StopAtBounds clip: true delegate: Item { width: gridView.cellWidth height: contentItem.implicitHeight required property string value Rectangle { id: contentItem width: parent.width color: "lightgray" implicitHeight: tex.implicitHeight + 20 Text { id: tex text: value wrapMode: Text.WordWrap anchors.margins: 10 anchors.fill: parent } } } } [image: 5511da81-8d79-4306-a3e0-805fb1a8683a.png] The desired behavior is lay items out onto the first column until it has free space and then turn into the next column (see picture in the question). Unfortunately, GridView lays item out strictly as a grid. This is partially implemented with Flow + Repeater layout: [image: 0887646e-c6a2-4106-b30c-ff9f8b07a38f.png]
  • Exclusive menu item check-mark not working

    Moved Unsolved 19 May 2025, 21:02
    0 Votes
    2 Posts
    254 Views
    Use Actions inside the Repeater, associate them with the ActionGroup, and bind them to the MenuItem. Menu { title: "Mouse mode" id: mouseModesMenu Repeater { model: mouseModes Action { id: mouseAction text: modelData checkable: true ActionGroup.group: mouseModeActions onTriggered: { console.log("selected", modelData) topoDataItem.setMouseMode(modelData) } } delegate: MenuItem { action: mouseAction } } } ActionGroup { id: mouseModeActions exclusive: true }
  • Qt3D Extras and Qt3D Core support in Qt 6.7.2 ?

    Unsolved 16 May 2025, 12:01
    0 Votes
    4 Posts
    329 Views
    @IamSumit said in Qt3D Extras and Qt3D Core support in Qt 6.7.2 ?: QQmlApplicationEngine failed to load component qrc:/qt/qml/Test3D/Main.qml:114:9: Qt3DExtras.Camera - Qt3DExtras is neither a type nor a namespace According to the docs, the Camera type is in Qt3D.Render, not Qt3D.Extras: https://doc.qt.io/qt-6/qml-qt3d-render-camera.html In QML, you don't prefix the type with the module/namespace. So write Camera instead of Qt3DRender.Camera (exception: If you apply a Qualifier to the import statement, then you would prefix the type with the Qualifier; see https://doc.qt.io/qt-6/qtqml-syntax-imports.html )
  • 0 Votes
    2 Posts
    218 Views
    I've found a solution. Find the folder with the same name as your Qml module which defined though qt_add_qml_module in the Debug folder ,copy it to the same-level directory as the exe file you want to publish, and then call windeployqyt. Hope this helps save some time for those who encounter this baffling error.
  • 0 Votes
    3 Posts
    229 Views
    @jsulm I didn't but I did now and it is indeed a behavior that was changed and there are bugs logged already.
  • Properties not accessible, of a custom QML type

    Solved 19 May 2025, 04:11
    0 Votes
    3 Posts
    277 Views
    Sorry man, my bad. I had a conflicting and similar type somewhere else named CameraDialog in APSS module. I don't know why QML Engine did not prefer the one in the same directory over the other. But it's solved.