Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.7k Posts
  • Create ring circle with animation

    Unsolved
    4
    0 Votes
    4 Posts
    539 Views
    U
    Hi, let me propose more sophisticated way to achieve this. Create a ring object dynamically to the desired position and run animation on opacity and size inside that component. Once the animation is completed, destroy the object. The lifetime of the ring object is then handled automatically and more declarative way. Here's example code: import QtQuick 2.15 import QtQuick.Window 2.15 Window { id: root width: 640 height: 480 visible: true title: qsTr("Hello World") MouseArea { anchors.fill: parent onClicked: ringComponent.createObject(root, {originX: mouse.x, originY: mouse.y}) } Component { id: ringComponent Rectangle { id: ring property int originX: 0 property int originY: 0 color: "transparent" border.color: "red" border.width: 5 x: originX - width/2 y: originY - height/2 height: width radius: width / 2 NumberAnimation on width { from: 0 to: 100 duration: 500 running: true } OpacityAnimator on opacity { from: 1 to: 0 duration: 500 onStopped: ring.destroy() } } } } Regards, Ulrich
  • How to show 3D real buildings in QML maps

    Unsolved
    1
    0 Votes
    1 Posts
    376 Views
    No one has replied
  • ListView example

    Unsolved
    4
    0 Votes
    4 Posts
    450 Views
    GrecKoG
    Do you read the doc? https://doc.qt.io/qt-6/qml-qtquick-listview.html#currentIndex-prop
  • Diffrences between Q_PROPERTY and Q_INVOKABLE

    Unsolved
    1
    0 Votes
    1 Posts
    210 Views
    No one has replied
  • How to make spin win whell?

    Unsolved
    2
    0 Votes
    2 Posts
    964 Views
    MarkkyboyM
    I would imagine, it would be more cost effective (cpu and gpu time) if the Win Wheel was a PNG or JPG, especially when it comes to animation (spinning/slowing/stopping/etc). But how to build that using QtQML, good question!. For instance, you could use the image you have given, this may well mean using something like Photoshop/GIMP/etc to get things looking how you want. With regard to the animation; once you have your component image (the spinwheel), you can look at animation, here might be a good place to get started; https://qmlbook.github.io/ch01-meetqt/meetqt.html#digesting-a-user-interface Using the very image you've provided, I put this together. It's a demo, not a complete app, but perhaps a good starting point? Built using SailfishSDK on Sony Xperia 10 II Dual SIM. Screenshot directly from device. Column { id: column spacing: 20 width: parent.width anchors.centerIn: parent Label { text: "\u25BC" font.pixelSize: 144 anchors.horizontalCenter: parent.horizontalCenter } Image { id: wheel source: "../images/win-wheel.png" anchors.horizontalCenter: parent.horizontalCenter PropertyAnimation on rotation { id: spinAnimation from: 0 to: 3610 duration: 10000 running: false easing.type: Easing.InOutQuint } MouseArea { anchors.fill: parent onClicked: { spinAnimation.running = true timer.start() label.opacity = 0.0 console.log(spinAnimation.duration) } } } Label { id: hint text: "Tap wheel to start" anchors.horizontalCenter: parent.horizontalCenter } Rectangle { width: wheel.width/2 radius: 20 height: 200 color: "white" border { width: 4 color: "green" } anchors.horizontalCenter: parent.horizontalCenter Label { id: label //visible: false opacity: 0.0 text: "WIN!" color: "black" font { bold: true pixelSize: 108 } anchors.centerIn: parent } Timer { id: timer interval: spinAnimation.duration running: false repeat: true onTriggered: { label.opacity = 1.0 } } } } [image: 687a606d-0970-47b9-866e-958c72acfd87.png]
  • Access members of `QVariant(PySide::PyObjectWrapper)` on QML

    Unsolved
    1
    0 Votes
    1 Posts
    499 Views
    No one has replied
  • qml FileDialog, does not want to open the selected image for me

    Unsolved
    1
    0 Votes
    1 Posts
    163 Views
    No one has replied
  • Transfer QQuickObject via Drag'n'Drop

    Unsolved
    1
    0 Votes
    1 Posts
    135 Views
    No one has replied
  • Qt Webassembly via conan package manager - "Could NOT find Qt6Quick"

    Unsolved
    3
    0 Votes
    3 Posts
    800 Views
    J
    A quick update : this https://bugreports.qt.io/browse/QTBUG-94524 (Introduce a QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH variable) will solve the issue above.
  • 0 Votes
    1 Posts
    177 Views
    No one has replied
  • Displaying Realsense camera stream using QT quick

    Unsolved
    1
    0 Votes
    1 Posts
    274 Views
    No one has replied
  • destroy filedialog does not clear the memory usage in qml

    Unsolved
    1
    0 Votes
    1 Posts
    143 Views
    No one has replied
  • problem with get values from QHash in qml

    Solved
    3
    0 Votes
    3 Posts
    457 Views
    Q
    @sierdzio thanks for answer, my problem solved thank you
  • How to keep ApplicationWindow aspect ratio

    Unsolved
    2
    0 Votes
    2 Posts
    589 Views
    K
    Is it any solution for this?
  • Dialogs in Qt 6 using CMake

    Solved
    10
    0 Votes
    10 Posts
    2k Views
    Q
    Still the problem with a property of FileDialog to bring the explorer window to select the file exits: Cannot assign to non-existent property "folder". I also tried currentfolder but the same error message!
  • Skip animation if its target is null

    Unsolved
    5
    1 Votes
    5 Posts
    409 Views
    M
    @KH-219Design yes, it's a segmentation fault. Would you please tell me how to capture the backtrace/callstack? When debugging I can see only a lot of disassembled code, but no one function (in any thread) is my code. I can prepare a sample project for you. In the meanwhile, can we generalize a bit the question? How to skip a step in a SequentialAnimation if some conditions are met?
  • What is the rectangle over the QML Button?

    Unsolved
    2
    0 Votes
    2 Posts
    295 Views
    MarkkyboyM
    Looks like you're using an OpacityMask on your Button but without radius being taken into account. Otherwise, post the snippet of code that produces the effect you show in your image, it might be easier to assess what's happening.
  • 0 Votes
    1 Posts
    184 Views
    No one has replied
  • QtQuick.VirtualKeyboard, slow language change

    Unsolved
    7
    0 Votes
    7 Posts
    788 Views
    sierdzioS
    @juvf said in QtQuick.VirtualKeyboard, slow language change: Why? The startup passed a long time ago. I guess layouts are loaded via a Loader element. So when it's sourceComponent is changed (to another layout), the data is loaded fresh. So this implies you could create a custom layout, make it small and fast and it will load fast. Or make it lazy-load and it will also look faster than it is (here I mean: initially load just empty rectangle, then fill in all the keys). A lot of the details are described here: https://doc.qt.io/qt-6/technical-guide.html
  • Lets play a game... thermonuclear wa...sorry QDate to JS Date conversion!

    Solved
    4
    0 Votes
    4 Posts
    508 Views
    D
    My approach was lossy. QDate loses time information. Changing data type for C++ to QDateTime keeps the time info even if I don't need that. The time zones have an affect. It seems JS Date can interchange between C++ QDate or QDateTime. QDateTime is the preferred and doesn't cause errors.