Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
19.8k Topics 76.4k Posts
  • PushButton icon spacing

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • QT can't load qml controls

    Solved
    8
    0 Votes
    8 Posts
    186 Views
    F

    Thank you @Bob64 @JoeCFD and @jsulm , I fallback to QT5.x, the program can run again.

  • 0 Votes
    4 Posts
    36 Views
    SGaistS

    Sorry, I misread something and thought you were using PyQt6...

    Which version of PySide6 are you using ?
    How did you install it ?

  • 0 Votes
    1 Posts
    7 Views
    No one has replied
  • Problem with virtual keyboard in WASM

    Unsolved
    3
    0 Votes
    3 Posts
    37 Views
    A

    Hi JKSH, you mean add in cmakeLists file but I will have second question, how it should look when I use qmake, not cmake?

  • Three.js support in Qt 6.7 ?

    Unsolved
    1
    0 Votes
    1 Posts
    29 Views
    No one has replied
  • 0 Votes
    4 Posts
    84 Views
    A

    I fixed this problem.
    I lost some Qt5Quick3D dll in my application path. this dll need use windeployqt to run qquick3dplugin.dll in cmd.

  • 0 Votes
    1 Posts
    17 Views
    No one has replied
  • 0 Votes
    2 Posts
    32 Views
    No one has replied
  • Why is setPreeditText not directly available in QML?

    Unsolved
    2
    0 Votes
    2 Posts
    34 Views
    U

    I found that the InputContext object in QML does not have a setPreeditText function. This method is only available in the C++ QInputMethodEvent class.
    QML: https://doc.qt.io/qt-5/qml-qtquick-virtualkeyboard-inputcontext.html
    C++: https://doc.qt.io/qt-5/qvirtualkeyboardinputcontext.html

    Below are my remaining questions:

    Is there any official documentation or Qt design guideline that explicitly mentions this limitation? If possible, could you share the recommended way to preedit text in QML?
  • 0 Votes
    3 Posts
    89 Views
    Pl45m4P

    @Lencho said in Advantage of declaring a QML module with qt_add_library over just using qt_add_qml_module:

    And what is the use/need of this declaration in that case?

    Q_IMPORT_QML_PLUGIN( MyExtraModulePlugin );
    It works with and without, so I'm missing the point.

    When you did not compile your own static Qt build, this does indeed nothing.

    (https://doc.qt.io/qt-6/qt-import-qml-plugins.html#description)

  • Issues With Customizing ScrollBar

    Solved
    10
    0 Votes
    10 Posts
    2k Views
    R

    Thank you very much. I will try it

  • QML TreeView with custom delegate

    Solved
    6
    0 Votes
    6 Posts
    166 Views
    O

    Hi!

    Thank you for your responses!

    Unfortunately, the documentation for TreeView is not very detailed, and examples are quite scarce. I followed your advice and dug deeper into how the delegate works for TreeView. As a result, I managed to achieve exactly what I needed, as shown in the original screenshot.

    To help others understand this topic more easily, I’ll share my code below.

    Key ideas:

    The entire view layout can be customized using the delegate. There’s no need to come up with complex solutions like DelegateChooser, which I had been trying earlier. You can use the column and row variables to determine which row or column is being processed. As mentioned earlier, to align text, you should use horizontalAlignment. You need to align the row yourself (make indents depending on the nesting). import QtQuick import QtQuick.Controls import Qt5Compat.GraphicalEffects Item { id: root width: 260 height: 700 TreeView { id: treeView anchors.fill: parent anchors.margins: 10 clip: true model: assetModel selectionModel: ItemSelectionModel { model: treeView.model } delegate: Item { implicitWidth: column === 0 ? root.width * 2/3 - padding * 2 : root.width * 1/3 - padding * 2 implicitHeight: label.implicitHeight * 1.5 readonly property real indentation: 20 readonly property real padding: 5 // Assigned to by TreeView: required property TreeView treeView required property bool isTreeNode required property bool expanded required property int hasChildren required property int depth required property int row required property int column required property bool current property Animation indicatorAnimation: NumberAnimation { target: indicator property: "rotation" from: expanded ? 0 : 90 to: expanded ? 90 : 0 duration: 100 easing.type: Easing.OutQuart } TableView.onPooled: indicatorAnimation.complete() TableView.onReused: if (current) indicatorAnimation.start() onExpandedChanged: indicator.rotation = expanded ? 90 : 0 Rectangle { id: background anchors.fill: parent color: row === treeView.currentRow ? "#0085F8" : "transparent" } Label { id: indicator x: padding + (depth * indentation) + 5 anchors.verticalCenter: parent.verticalCenter visible: isTreeNode && hasChildren text: "▶" color: "white" TapHandler { onSingleTapped: { let index = treeView.index(row, column) treeView.selectionModel.setCurrentIndex(index, ItemSelectionModel.NoUpdate) treeView.toggleExpanded(row) } } } Image { id: image x: (isTreeNode ? (depth + 1) * indentation : 0) anchors.verticalCenter: parent.verticalCenter width: 13 height: 13 source: hasChildren ? "../../images/svg-folder.svg" : "../../images/svg-file.svg" visible: column === 0 ? true : false ColorOverlay { source: image anchors.fill: image color: "white" } } Label { id: label x: image.x + image.width + 5 anchors.verticalCenter: parent.verticalCenter width: parent.width - padding - x clip: true text: model.display color: column === 0 ? "white" : "#ABABAB" font.pixelSize: column === 0 ? 14 : 10 horizontalAlignment: isTreeNode ? Text.AlignLeft : Text.AlignRight rightPadding: 10 font.family: "Roboto Medium" } } MouseArea { id: menuMouseArea anchors.fill: parent acceptedButtons: Qt.RightButton Connections { target: menuMouseArea onClicked: { menu.open() menu.x = menuMouseArea.mouseX menu.y = menuMouseArea.mouseY } } } } Menu { id: menu width: 150 leftPadding: 5 font.family: "Roboto Medium" palette.window: "#1f1f1f" palette.text: "white" palette.windowText: "white" palette.light: "#898989" MenuItem { text: "Rename" icon.source: "../../images/svg-edit.svg" icon.width: 14 icon.height: 14 } MenuItem { text: "Delete" icon.source: "../../images/svg-trash.svg" icon.width: 14 icon.height: 14 } } }

    Now it looks like this:
    2025-01-21_16-47-47.png

    Thank you all!

  • Can't dynamically update CandlestickSeries in QtCharts

    Unsolved
    3
    0 Votes
    3 Posts
    68 Views
    S

    Okay thanks I will give it a try.

  • Is it possible to use Qt Quick modules without QML?

    Unsolved
    16
    1 Votes
    16 Posts
    875 Views
    B

    @drwho-0 said in Is it possible to use Qt Quick modules without QML?:

    quick widget substantiation

    I'm curious about this - what does this mean?

  • 0 Votes
    2 Posts
    53 Views
    T

    I've managed to get to the bottom of this. We have extended the qml Text item with our own type and use it for building menus, labelling buttons and other widgets. It turns out this extended Text item has a ToolTip added in by us ... this must be a big no-no, because thanks to the heavy use of this Text item we instance 1500 text items and therefor 1500 of the ToolTips .... it's those tool tips that are registering somewhere in the QAccessible system (I think because they inherit PopUp, and I think on Windows a PopUp is a Window which make themselves known to QAccessible). This is killing the performance in that setActive method, I suppose 1500 hidden windows is probably a bit excessive!

    (I realise I contradicted myself in the OP about the number of Text items, it turns out I wasn't counting them correctly in the first place.)

  • 0 Votes
    3 Posts
    47 Views
    napajejenunedk0N

    Qt 6.5.3.16
    Windows 11 Enterprise 23H2 22631.4602
    JAWS 2025.2412.50

  • 0 Votes
    2 Posts
    61 Views
    SGaistS

    Hi and welcome to devnet,

    What exactly are you expecting from people here ?

    On a side note, please using coding tags (using for example de </> button) to make your code readable.

  • 0 Votes
    3 Posts
    625 Views
    P

    For anyone coming across this thread, the answer is...

    tl;dr: You need to add the runFullTrust capability.

    With Qt 5, there was support for UWP apps. This made it possible for Windows apps to be delivered through the Microsoft Store. (This is how my app was built and delivered.)

    Then Microsoft opened up the Microsoft Store for Win32 apps too; i.e. standard desktop apps. As a developer you have a choice of either packaging your own installer and delivering that through the Microsoft Store, or just your app, letting Microsoft Store handle installation. The latter option behaves more like the handling of a UWP app and Microsoft handles the code-signing certificate for you.

    As a consequence, Qt decided to drop support for UWP as of Qt 6. This was done with no public notification to the Qt community 🤬, with just a message on the Qt development mailing list. I eventually found this out via a convoluted bug report.

    What Qt themselves did not realise is that if you submit a Win32 app via the Microsoft Store, because it is a desktop app and does not sit nicely in a sandbox like a UWP app, you need to add the runFullTrust capability. If you don't do this, you get the weird behaviour of the application window opening in a separate window described above.

    However be aware that when you add runFullTrust Microsoft will require you to justify why your app needs access to the whole Windows system. I was able to pass certification with a message along the lines of "My app is built with the Qt framework that only generates Win32 apps. My app does not operate outside the sandbox and behaves nicely."

    One more gotcha if you're going this route. The path QStandardPaths::AppDataLocation was different for UWP apps than Win32 apps. The following only applies if you had a UWP app in Qt 5 and stored data there as the path will be wrong for your Win32 app in Qt 6. To fix this, I use the following: https://gist.github.com/paulmasri/75dcd3386a4e8eaf705058240ef547d1

  • Question about Component.onCompleted: signal handler

    Unsolved
    2
    0 Votes
    2 Posts
    72 Views
    BondrusiekB

    Component is a special type in the QtQml module that acts as a blueprint for creating objects in QML. Every QML object is implicitly part of a Component, even if you don't explicitly wrap it in a Component block. For example:

    import QtQuick Item { Component.onCompleted: { console.log("Hello World") } }

    Internally, QML treats this as if it is wrapped in a Component:

    import QtQuick Component { Item { Component.onCompleted: { console.log("Hello World") } } }

    You can analyze QQuickItem class and you will see that it inherits from QObject and QQmlParserStatus, hence it is possible to call Component.onCompleted() in Item objects.