Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • OSM map not showing in minimal map example on ios

    Unsolved
    4
    0 Votes
    4 Posts
    636 Views
    L
    @Colton Don't forget the plugin: import QtQuick 2.15 import QtQuick.Window 2.15 import QtLocation 5.12 import QtPositioning 5.12 Window { width: 760 height: 480 visible: true title: qsTr("Map Demo") Plugin { id: mapPlugin name: "osm" // Open Street Maps PluginParameter { name: "osm.mapping.highdpi_tiles" value: true } } Map { id: map anchors.fill: parent plugin: mapPlugin zoomLevel: 18 copyrightsVisible: false gesture.enabled: true gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture | MapGestureArea.TiltGesture } }
  • qmllint Qt 6.3.0 beta3 compile Type error on signal handler

    Unsolved
    2
    0 Votes
    2 Posts
    430 Views
    J
    Based on this presentation, it looks like the goal is to add support for TypeScript-like type annotations in order for the script to be compilable. How To Use QML in Qt6 https://www.youtube.com/watch?v=4ji6D6UpA54 32:53 It seems like the detection tool (qmllint) is ahead of the language support because if I try that: onWheel: function (wheel: WheelEvent) { root.exampleValue += root.exampleValue * (wheel.angleDelta.y / 1200) } I get this: $ qmllint --compiler warning main.qml main.qml:13:33: Type annotations are not permitted in function parameters in JavaScript functions ... and this (showing it's not just a spurious tool warning): $ qml main.qml QQmlApplicationEngine failed to load component file:///xxxx/Wheelies/main.qml:13:33: Type annotations are not permitted in function parameters in JavaScript functions qml: Did not load any objects, exiting. This page on qmllint does not state explicitly whether the tool is in Technical Preview as of Qt 6.3.0 beta3 or Qt 6.4. https://doc-snapshots.qt.io/qt6-dev/qtquick-tool-qmllint.html Neither does the tool's help. I found this in the interest@qt-project.org mailing list regarding adding type annotations. If I'm reading it correctly, support is already there, but qml cannot run the file with the type annotation as of Qt 6.3.0 beta3 (see above): https://codereview.qt-project.org/c/qt/qtdeclarative/+/249400 Does anyone know more?
  • How to Prevent overlapping HoverHandler steals event?

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    M
    @fcarney hmm, Unfortunately It didn't. :(
  • Canvas - alternative ?

    Unsolved
    3
    0 Votes
    3 Posts
    500 Views
    fcarneyF
    I used some shape stuff to replace my canvas code. I used Instantiators for some ShapePaths inside of Shape. I also used Repeaters for some Shapes and PolyMultiLine for some more complex paths inside those. I was doing mostly line drawing. Just be aware some of these objects are Item based and some are QObject based. I have no idea how fast it was compared to my original Canvas code. But it ended up being less complex and I made it all data driven via ListModel and js arrays. How many lines are we talking?
  • Assign SequentialAnimation at runtime

    Solved
    4
    0 Votes
    4 Posts
    281 Views
    Q
    I learned that I cannot assign a SequentialAnimation at runtime. So I solved it by using the same colors for the static color and two diffrent colors for blinking. Here is my final code. GroupBox { id: sensorValueGroupBox width: 232 height: 216 property string sensorType: qsTr("Sensor") property TwoColorAnimationStyle colorAnimationStyle: TwoColorAnimationStyle{} // simple QtObject that holds color and duration settings background: Rectangle{ radius: 20 color: "transparent" width: parent.width height: parent.height border.color: "lightgreen" } Label { id: sensorTypeLabel text: sensorType font { pointSize: 24 bold: true family: "OCR A Extended" } wrapMode: Text.WordWrap padding: 5 background: Rectangle { id: labelBackground anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.fill: parent color: "white" Behavior on color { SequentialAnimation { id: blinkingAnimation loops: colorAnimationStyle.loops running: false PropertyAnimation { to: colorAnimationStyle.color2; duration: colorAnimationStyle.sequenceDuration} // switch over to second color PauseAnimation { duration: colorAnimationStyle.pauseDuration} // stay with this color for a while PropertyAnimation { to: colorAnimationStyle.color1; duration: colorAnimationStyle.sequenceDuration} // switch over to first color PauseAnimation { duration: colorAnimationStyle.pauseDuration} // stay with this color for a while } } states: [ State { name: "OkState" when: colorComboBox.currentValue === "green" // change animation colors and loops (simply use same color and loop once to simulate a static color) PropertyChanges { target: colorAnimationStyle loops: 1 color1: "green" color2: "green" } // change color itself to trigger animation PropertyChanges { target: labelBackground color: "green" } }, State { name: "WarningState" when: colorComboBox.currentValue === "yellow" // change animation colors and loops (simply use same color and loop once to simulate a static color) PropertyChanges { target: colorAnimationStyle loops: 1 color1: "yellow" color2: "yellow" } // change color itself to trigger animation PropertyChanges { target: labelBackground color: "yellow" } }, State { name: "AlertState" when: colorComboBox.currentValue === "red" // change animation colors and loops (simply use same color and loop once to simulate a static color) PropertyChanges { target: colorAnimationStyle loops: 1 color1: "red" color2: "red" } // change color itself to trigger animation PropertyChanges { target: labelBackground color: "red" } }, State { name: "AlertBlinkingState" when: colorComboBox.currentValue === "blinking" // use two different colors and infinite loop for blinking effect PropertyChanges { target: colorAnimationStyle loops: -1 // infinite loop (assigning Animation.Infinite doesn't work here) color1: "white" color2: "red" } // change color itself to trigger animation PropertyChanges { target: labelBackground color: "blue" } } ] } } ComboBox { id: colorComboBox anchors.centerIn: parent currentIndex: 0 model: ["green", "yellow", "red", "blinking"] } } with the external QtObject that defines the animation behavior import QtQuick 2.15 /// declare object that holds colors and settings for a two color animation QtObject { /// for sequential color animation this is should be first color to show property color color1: "green" /// for sequential color animation this is should be second color to show property color color2: "green" /// number of loops of animation property int loops: 1 /// duration of an animation sequence (by default set to 0 to avoid animation) property int sequenceDuration: 0 /// duration of a pause between animation sequences property int pauseDuration: 500 }
  • Displaying a C++ class via QML in QtQuick2

    Solved
    3
    0 Votes
    3 Posts
    552 Views
    E
    Thanks so much, that is indeed what I ended with!
  • qml file problem using design studio

    Unsolved qml qtquick qtdesignstudio
    1
    0 Votes
    1 Posts
    555 Views
    No one has replied
  • Using QAbstractModel

    Unsolved
    20
    0 Votes
    20 Posts
    1k Views
    M
    @GrecKo said in Using QAbstractModel: As for @Mihaill , nowhere in your code is your underlying data changed. Where/how do you change it? I change data in QVector<RegistrationObject> vectorDataRegistration; and after use function emitSignalUpdateModel()
  • Cannot draw a single rectangle at constant 60fps

    Solved
    2
    0 Votes
    2 Posts
    217 Views
    CharbyC
    Just find out that since a recent OS upgrade the hardware acceleration was not activated on my device, installing nvidia driver fixed this issue.
  • Transferring data between two QtQuick apps and local storage

    Unsolved
    6
    0 Votes
    6 Posts
    430 Views
    SGaistS
    So in fact, it's just some kind of setting of the app ? If so, just use QSettings.
  • QML ScrollView velocity

    Unsolved
    1
    0 Votes
    1 Posts
    254 Views
    No one has replied
  • Binding loop detection seems very sensitive

    Solved
    3
    0 Votes
    3 Posts
    254 Views
    fcarneyF
    BTW, out of curiosity, I found you can break the detection this way and create programs that will lock up. So be careful: import QtQuick 2.15 import QtQuick.Window 2.15 Window { width: 640 height: 480 visible: true title: qsTr("Binding Loop") property bool bind: false property bool update_: false property bool refresh: update_ onRefreshChanged: { console.log("refresh", refresh) if(refresh){ if(bind){ update_ = false }else{ Qt.callLater(resetUpdate) } } } function resetUpdate(){ update_ = false //Qt.callLater(()=>{update_ = true}) // can easily break detection } Component.onCompleted: update_ = true }
  • Creating a C++ identifier for a dynamically generated object

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    L
    @Snorlax the signal is only triggered when the signal from the c++ file is emitted. Therefore, you have to enter something in the input field and click the save button. As the example returns if you set the same name again, it won't emit a signal if you click the save button multiple times without changing the input field value: void BackEnd::setUserName(const QString &userName) { // do not proceed if current name is equal to new name if (userName == m_userName) return; m_userName = userName; emit userNameChanged(); }
  • Error when running Minimal Map Example

    Solved
    3
    0 Votes
    3 Posts
    3k Views
    A
    @ronaldo Thankyou man,you solved a big problem for me.
  • Qt Quick design issue

    Unsolved
    3
    0 Votes
    3 Posts
    405 Views
    K
    @Thomas-Hartmann There is no error shown in the edit mode. for some reason i couldn't use the design mode. When ever i switch from edit panel to Design panel, the Design opens 3 windows of compiled output and upon closing them i couldn't add the shapes and all.I can change properties like color and only visible when i run the application. .!![image: 7a55a22e-eb62-4dc7-8507-4d0013dbd179.png]
  • Customising Qt Virtual Keyboard QML for a cross-compiled, remote device

    Unsolved
    5
    0 Votes
    5 Posts
    3k Views
    L
    my setup was used on an embedded yocto project. the requirements for it to work: add virtualkeyboard to the remote-image. for yocto add : qtvirtualkeyboard (included in the meta-qt5 layer) to local.conf IMAGE_INSTALL_append = " qtvirtualkeyboard \ make sure everything is updated accordingly -> rebuild toolchain -> rebuild remote-image -> install latest image on embedded device make sure to build your project with the remote-toolchain -> e.g. source it before launching qtcreator from command line
  • 0 Votes
    2 Posts
    244 Views
    dheerendraD
    This should work. Can you give complete example ? Also endRemoveRows().. is not a signal.
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    70 Views
  • Can't operate over reproducing local Video .mp4 saved locally.

    Unsolved
    2
    0 Votes
    2 Posts
    192 Views
    T
    Hello All, I fixed the main problem of this topic. My video was playing as Stream due to one configuration in NVR SDK communication, so it was being downloaded as Stream Type an no Quicktime. However, I'm facing a new problem: I have one component once it is clicked my video jump forward/backward for 5000ms. When I use this a lot of times, my video freeze and I can't reproduce again, only if I stop and play again. The same problem happened when I change the playbackRate variable from 1 to 2, to 4, to 8....
  • Hardware acceleration in Ubuntu 21.10

    Unsolved
    1
    0 Votes
    1 Posts
    448 Views
    No one has replied