跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k 主題 77.4k 貼文
  • QMLlint warning for ids

    Unsolved
    3
    0 評價
    3 貼文
    148 瀏覽
    JKSHJ
    You need required property int index in gridDelegate (see https://doc.qt.io/qt-6/qtquick-modelviewsdata-modelview.html#view-delegates ) deleteIndex is qualified (this is good), but index is unqualified (this is bad). Qualify index too: root.deleteIndex == gridDelegate.index (see https://doc.qt.io/qt-6/qmllint-warnings-and-errors-unqualified.html )
  • How to make the animation run as expected

    Unsolved
    2
    0 評價
    2 貼文
    79 瀏覽
    MarkkyboyM
    Please learn to format your code correctly. It makes things so much easier for those attempting to help you.
  • QML with VS Code - Builds but fails at runtime (Windows)

    Unsolved
    3
    0 評價
    3 貼文
    152 瀏覽
    C
    This is helpful thanks
  • Getting binding loop when checking mousearea.containsMouse on a drag operation

    Solved
    6
    0 評價
    6 貼文
    1k 瀏覽
    E
    Unfortunately, the stackoverflow solution doesn't work if you're depending on mime settings or imageSource (or requires some more effort to make it work), but the delayed binding solution did work.
  • Qmllint Warnings for rootcontextproperty

    Unsolved
    2
    0 評價
    2 貼文
    75 瀏覽
    jeremy_kJ
    Hi, Please use the code (</>) tags. The general advice is to avoid context properties. Embedding C++ Objects into QML with Context Properties spells out a few reasons, including the one noted here. My preferred fix is to declare a property within the item, and then set it using an API such as QQmlComponent::createWithInitialProperties()
  • MouseArea and WebEngine: Qt6 Bug?

    Unsolved qml webengine mousearea
    3
    1 評價
    3 貼文
    430 瀏覽
    SGaistS
    @viliak hi and welcome to devnet, I think you should check and maybe create a ticket on the bug tracker since it's a pretty big change of behavior.
  • Working in Creator and Design Studio simultanously: C++ backend integration possible?

    Unsolved
    4
    0 評價
    4 貼文
    655 瀏覽
    A
    Hello @Raphael_PF . Normally you should have a "mock" backend to avoid that errors in order to be able to preview your design. By following this: https://doc.qt.io/qtdesignstudio/robotarm-example.html you will be able to work with both programs. In your qmlproject: importPaths: ["."] mockImports: ["stubs"] You can read here the cmakelist qt design autogeneration: https://github.com/qt-creator/qt-creator/blob/b60337dbaace15ac36d7f44f60d17560111a9ae3/src/plugins/qmlprojectmanager/qmlprojectexporter/cmakegenerator.cpp#L305 [image: 882cf003-42af-4b90-baa9-bfddbf718e0c.png]
  • Handling key events in Wayland compositor (IviApplication)

    Solved iviapplication
    2
    0 評價
    2 貼文
    120 瀏覽
    HoratioH
    Answering my own question... Pass WaylandCompositor's property - defaultSeat into C++ as QWaylandSeat*. https://doc.qt.io/archives/qt-5.15/qml-qtwayland-compositor-waylandcompositor.html#defaultSeat-prop WaylandCompositor { id: iCompositor Component.onCompleted: { CppHelper.setDefaultWaylandSeat( iCompositor.defaultSeat ); } } Use QWaylandSeat's setKeyboardFocus(), which takes QWaylandSurface*. https://doc.qt.io/archives/qt-5.15/qwaylandseat.html#setKeyboardFocus QWaylandSurface* can be found in the onIviSurfaceCreated() as iviSurface. You can pass it into C++. IviApplication { onIviSurfaceCreated: { var surfaceArea = iviSurface.iviId === 1337 ? leftArea : rightArea; var item = chromeComponent.createObject(surfaceArea, { "shellSurface": iviSurface } ); item.handleResized(); // Pass QWaylandSurface* into C++. CppHelper.registerIviSurface( iviSurface ); } } The signal keyboardFocusChanged can be used to observe the change. https://doc.qt.io/archives/qt-5.15/qwaylandseat.html#keyboardFocusChanged However, setKeyboardFocus() doesn't work very well. I do get the signal keyboard focus changed, but the focus jump back to the original window if I actually press a keyboard key.
  • Creating a dynamic spline in QML

    Solved
    4
    0 評價
    4 貼文
    168 瀏覽
    J
    @GrecKo Ah that was a little painfully obvious haha! Thank you for pointing that out. I've been banging my head against the wall learning about shapepaths for hours now, and thought that there was a more explicit object type for the job. Turns out it was right in front of me all along!
  • Qt 6 adding qt_add_translations() to CMake creates empty .ts files.

    Unsolved
    5
    1 評價
    5 貼文
    1k 瀏覽
    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 貼文
    294 瀏覽
    P
    Okay , @jsulm Thank you I will check it out.
  • 0 評價
    2 貼文
    91 瀏覽
    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 貼文
    153 瀏覽
    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 貼文
    344 瀏覽
    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 貼文
    738 瀏覽
    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 貼文
    102 瀏覽
    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 貼文
    204 瀏覽
    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 貼文
    672 瀏覽
    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 {} }
  • 此主題已被刪除!

    Unsolved
    1
    0 評價
    1 貼文
    16 瀏覽
    尚無回覆