Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • Row component: Invalid property name "leftPadding"

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    GrecKoG
    Which Qt Quick version are you importing in your QML file? My guess is that you should replace import QtQuick 2.0 by import QtQuick 2.15.
  • How to include .idl in project and generate files

    Unsolved
    2
    0 Votes
    2 Posts
    255 Views
    jsulmJ
    @Snorlax In QMake you will have to write a custom build step, see https://doc.qt.io/qt-5/qmake-advanced-usage.html
  • Why this stackview.pop not working?

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    KroMignonK
    @GrecKo said in Why this stackview.pop not working?: no, this is fine. https://doc.qt.io/qt-6/qtqml-syntax-objectattributes.html#considerations-for-property-aliases. Thanks for the update! Didn't know this. I am always a little bit paranoiac about possible binding loop issues, they are never easy to find / resolve.
  • QNetworkAccessManager crash

    Unsolved
    3
    0 Votes
    3 Posts
    317 Views
    J
    @jbarrena said in QNetworkAccessManager crash: QNetworkAccessManager Thanks SGaist. We are about to upgrade to 5.15 during this week, but we haven´t found any bug fixing related to this issue in recent releases. We will try 5.15 and expose here the obtained results. Thanks. Julen.
  • Left-click on plasmoid in system tray fails to execute command

    Unsolved
    1
    0 Votes
    1 Posts
    311 Views
    No one has replied
  • MP3 file is playing without sound when MediaPlayer's source is set to https url

    Unsolved
    1
    0 Votes
    1 Posts
    96 Views
    No one has replied
  • How to Grab Image and Show in next Slide?

    Solved
    4
    0 Votes
    4 Posts
    360 Views
    I
    @lemons It's work thanks
  • OSM map not showing in minimal map example on ios

    Unsolved
    4
    0 Votes
    4 Posts
    639 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
    463 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
    509 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
    282 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
    561 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
    563 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
    225 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
    434 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
    257 Views
    No one has replied
  • Binding loop detection seems very sensitive

    Solved
    3
    0 Votes
    3 Posts
    256 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(); }