跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k 主題 77.7k 貼文
  • ListView Model setProperty Work only 1 time

    Solved
    3
    0 評價
    3 貼文
    208 瀏覽
    dheerendraD
    In addition to what @lemons said, model property is not updated when you changed the check box from UI. Hence the issue. You can try with following piece of code inside the CheckBox. onClicked: { _root.ListView.view.model.setProperty(1, "mystatus",checked) }
  • How to write a QML extension from a custom C++ class?

    Solved qtquick c++ qt extension
    7
    0 評價
    7 貼文
    2k 瀏覽
    G
    when I rerun, I am told that QtWebView cannot contain more than one item, so I guess I cannot save a c++ class in QtWebView, going through the doc I found that the c++ classes I needed had already been extended to the quick module. So, I'm going to use the c++ classes in this module instead. Thank you very much for your help.
  • It was worked for me too

    Unsolved
    1
    0 評價
    1 貼文
    224 瀏覽
    尚無回覆
  • CheckBox Indicator Image bug

    Unsolved
    1
    0 評價
    1 貼文
    257 瀏覽
    尚無回覆
  • Garbage collector issue

    Solved
    10
    0 評價
    10 貼文
    600 瀏覽
    jeanmilostJ
    @fcarney Wow excellent, this work very well. Thank you very much for your help
  • Visibility of delegate in pathview in QML

    Unsolved @dheerendra @qmlandqtquick @pathviewdeleag
    1
    0 評價
    1 貼文
    291 瀏覽
    尚無回覆
  • Row component: Invalid property name "leftPadding"

    Solved
    4
    0 評價
    4 貼文
    1k 瀏覽
    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 評價
    2 貼文
    262 瀏覽
    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 評價
    11 貼文
    1k 瀏覽
    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 評價
    3 貼文
    326 瀏覽
    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 評價
    1 貼文
    318 瀏覽
    尚無回覆
  • MP3 file is playing without sound when MediaPlayer's source is set to https url

    Unsolved
    1
    0 評價
    1 貼文
    99 瀏覽
    尚無回覆
  • How to Grab Image and Show in next Slide?

    Solved
    4
    0 評價
    4 貼文
    370 瀏覽
    I
    @lemons It's work thanks
  • OSM map not showing in minimal map example on ios

    Unsolved
    4
    0 評價
    4 貼文
    649 瀏覽
    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 評價
    2 貼文
    485 瀏覽
    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 評價
    5 貼文
    1k 瀏覽
    M
    @fcarney hmm, Unfortunately It didn't. :(
  • Canvas - alternative ?

    Unsolved
    3
    0 評價
    3 貼文
    522 瀏覽
    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 評價
    4 貼文
    291 瀏覽
    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 評價
    3 貼文
    585 瀏覽
    E
    Thanks so much, that is indeed what I ended with!
  • qml file problem using design studio

    Unsolved qml qtquick qtdesignstudio
    1
    0 評價
    1 貼文
    569 瀏覽
    尚無回覆