跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k 主題 77.2k 貼文
  • Qt 6 adding qt_add_translations() to CMake creates empty .ts files.

    Unsolved
    5
    1 評價
    5 貼文
    938 瀏覽
    A
    Best solution, independent from changing the targets manually, is to add: add_dependencies(${PROJECT_NAME} update_translations)
  • .EXE file is not opening and not find exe file

    Unsolved
    9
    0 評價
    9 貼文
    99 瀏覽
    P
    Okay , @jsulm Thank you I will check it out.
  • 0 評價
    2 貼文
    32 瀏覽
    jsulmJ
    @MARUTI-0 said in How can you implement offline mapping in a Qt application using QML and CMake without internet access?": SOLVE THE PROBLEM First describe the problem in an understandable way and then ask for help. People here do not have to solve your problems, this is user forum.
  • Enabling anti-aliasing on QQuickItem or QSGGeometryNode

    Unsolved
    2
    0 評價
    2 貼文
    97 瀏覽
    A
    I came across this example which uses QRhi (which avoids dependence on OpenGL directly like other people said to use): https://doc.qt.io/qt-6/qtquick-scenegraph-customrendernode-example.html It still seems overly complex but at least it looks like I'm in the right direction. Then, I came across this: https://doc.qt.io/qt-6/qrhirenderbuffer.html#sampleCount where I can set sampleCount to enable anti-aliasing. I don't really understand how QRhiRenderBuffer can be used, but somehow using QRhiRenderBuffer with sampleCount set to 4 or 8 in a QSGRenderNode -derived class seems like the proper way to have cross-platform hardware-accelerated anti-aliased drawing. Feel free to correct me. Until I find code examples showcasing how to bring all these functionalities together I have more important things to work on so I'll use QML Shape / ShapePath for now which makes it super easy to draw simple things (like an anti-aliased triangle).
  • Customizing Menu

    Unsolved
    6
    0 評價
    6 貼文
    168 瀏覽
    G
    theoretically, it would also work to just assign a number like 200 for the width. The issue remains that as soon as I try to edit the background, the massive margins appear again.
  • Debugging QML?

    Solved
    15
    0 評價
    15 貼文
    274 瀏覽
    D
    @ekkescorner yes its a good idea to read the documentation (and I do), but we also have to play the new user role to make sure the flow of discovery of information is correct. I do not see where I would have discovered that information, without encountering an error that I had to seek help for. In the Qt Quick article (that would be the entry point for many people starting QML) there is no mention of this page. It is only in the navigation, and burried under another article called Qt QML. Not only that, but on the Qt Quick page, there is a link to an article describing debugging (which makes no mention of the QML Tooling page) and a link to a "Qt Quick Tools And Utilities" page, which is completely different and makes no mention of QMLLS. [image: 2ad8c5dc-8889-4d22-8ddf-4343c65ad971.png]
  • 此主題已被刪除!

    Unsolved
    2
    0 評價
    2 貼文
    7 瀏覽
  • How to get default value in qml?

    Unsolved
    2
    0 評價
    2 貼文
    57 瀏覽
    J.HilkJ
    @TomNow99 Use an explicit binding, instead of a JS-Evauation Binding { target: xyzInstance; property: "x"; value: myTextField.text; when: someCondition; restoreMode: Binding.RestoreValue}
  • Scrollbar Quirks

    Solved
    3
    0 評價
    3 貼文
    126 瀏覽
    P
    Thank you so much, Mid does indeed change the color of the handle, but another color seems to control the color of the handle while it is being dragged. I will figure it out. One more question. Is this documented anywhere? Or is the source code available? I searched everywhere I could think of and could not locate it. I found this page: https://doc.qt.io/qt-6/qtquickcontrols-fusion.html which only covers a subset of the palette usage.
  • Equivalent to QGraphicsView and QGraphicsScene?

    Unsolved
    9
    0 評價
    9 貼文
    471 瀏覽
    S
    Thanks to y'all who replied. @JoeCFD @Asperamanca @GrecKo @Axel-Spoerl @JKSH I had looked at the Drag and Drop examples but they used the DropArea type which didn't fit my need because it wouldn't allow me to place the tiles freely in a shared plane, or at least that's my understanding. With the help of AI tools (which I've found extremely useful in fast prototyping a project, especially in a framework that I'm not familiar with like in this case QML), I've created exactly what I needed with basic Qt Quick Items. Here's the basic structure: Window { // button to add a new tile Button { onClicked: { tileComponent.createObject(dashboardArea, { "x": /* x position in dashboard area */, "y": /* y position in dashboard area */, "tile specific properties": data }); } } // dashboard area Item { id: dashboardArea // this component holds dynamically created tiles Component { id: tileComponent Tile {} } } } // Tile.qml Rectangle { // tile specific properties ... // Make the tile draggable MouseArea {} }
  • Handling key events in Wayland compositor (IviApplication)

    Unsolved iviapplication
    1
    0 評價
    1 貼文
    48 瀏覽
    尚無回覆
  • QML with VS Code - Builds but fails at runtime (Windows)

    Unsolved
    1
    0 評價
    1 貼文
    51 瀏覽
    尚無回覆
  • 此主題已被刪除!

    Unsolved
    1
    0 評價
    1 貼文
    16 瀏覽
    尚無回覆
  • 此主題已被刪除!

    Unsolved
    1
    0 評價
    1 貼文
    4 瀏覽
    尚無回覆
  • QQmlApplicationEngine failed to load component

    Unsolved
    3
    0 評價
    3 貼文
    124 瀏覽
    JKSHJ
    @imxande said in QQmlApplicationEngine failed to load component: want to understand what is really happening. One way to start doing this is to inspect your embedded resources: QDirIterator qrc(":", QDirIterator::Subdirectories); while(qrc.hasNext()) qDebug() << qrc.next(); Note that if I add engine.addImportPath("qt/qml") to my main.cpp file the engine finds the module What does engine.importPathList() produce after you do that?
  • Qt 6.5: QML TableView lose resizing ability when using columnWidthProvider

    Unsolved
    4
    3 評價
    4 貼文
    699 瀏覽
    Z
    some tips for this. ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("HeaderView") TableModel { id: qmlTabModel TableModelColumn { display: "name" } TableModelColumn { display: "color" } TableModelColumn { display: "age" } rows: [ { "name": "cat", "color": "black", "age": "1.1" }, { "name": "dog", "color": "brown", "age": "1.2" }, { "name": "bird", "color": "white", "age": "1.3" } ] } Rectangle { id: bgtab anchors.fill: parent color: Qt.styleHints.appearance === Qt.Light ? palette.mid : palette.midlight onWidthChanged: { tableView.forceLayout() } HorizontalHeaderView { id: horizontalHeader anchors.left: tableView.left anchors.right: parent.right; anchors.top: parent.top syncView: tableView clip: true model: qmlTabModel delegate: Label { text: qmlTabModel.columns[column].display } } VerticalHeaderView { id: verticalHeader anchors.top: tableView.top anchors.left: parent.left syncView: tableView clip: true } TableView { id: tableView anchors.left: verticalHeader.right anchors.top: horizontalHeader.bottom anchors.bottom: parent.bottom contentWidth: parent.width; columnSpacing: 1 rowSpacing: 1 boundsBehavior: Flickable.StopAtBounds property var columnWidths: [100, 50, bgtab.width] columnWidthProvider: function(column) { let w = explicitColumnWidth(column) if (w >= 0 && column !== (columns - 1)) { columnWidths[column] = w; return w; } if (column === (columns - 1)) { w = columnWidths[column]; let i = columns - 1; while(--i !== -1) w -= columnWidths[i]; return w; } return columnWidths[column]; } model: qmlTabModel delegate: Rectangle { implicitHeight: 20 color: palette.base Label { text: display } } } } }
  • How to propagate hover events when using MouseArea?

    Solved mousearea hover mouse event event handling
    4
    0 評價
    4 貼文
    161 瀏覽
    GrecKoG
    Nice, note that TapHandler has a doubleTapped signal.
  • How to dynamically pair qml objects with c++ objects

    Solved
    29
    0 評價
    29 貼文
    1k 瀏覽
    GrecKoG
    Yes that's exactly what I meant, thanks for explaining it Bob64.
  • QMediaPlayer and Qml

    Unsolved
    2
    0 評價
    2 貼文
    82 瀏覽
    jsulmJ
    @SetupIa Take a look at this example: https://doc.qt.io/qt-6/qtmultimedia-video-qmlvideo-example.html
  • "at least one required feature is not present" error

    Unsolved
    2
    0 評價
    2 貼文
    95 瀏覽
    H
    i tried "link with qt", but result is the same.