跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k 主題 77.7k 貼文
  • How to make ListView moving at a constant speed?

    Unsolved listview flick
    1
    0 評價
    1 貼文
    507 瀏覽
    尚無回覆
  • QML Nested List view with Highlight

    Unsolved
    1
    0 評價
    1 貼文
    1k 瀏覽
    尚無回覆
  • [Solved] How to flick ListView items programmically

    2
    0 評價
    2 貼文
    554 瀏覽
    V
    ok, actually works as expected. If not disabling highlight following
  • section-wise scrolling in TableView

    Unsolved tableview qml section scroll
    3
    0 評價
    3 貼文
    2k 瀏覽
    I
    @SGaist That's pretty close to what I like to achieve. Unfortunately I am using a QML TableView. The only difference to the FrozenColumnExample is that my Frozen Rows have a dynamic count. A binary role in my table model determines to which section the entry belongs to. I will try to adapt the FrozenColumnExample to my case in QML. That was my idea anyway, but I was hoping for more simple solution ;) Substituting the sections with seperate TableViews and using a QSortFilterProxyModel to simulate the section behavior is the way to go I guess. Thx for your tip.
  • [SOLVED] Is this a reasonable way to do continuous sprite animation in QML?

    animation qml
    6
    0 評價
    6 貼文
    3k 瀏覽
    Hamed.MasafiH
    The Sprite type has a property named to. In the to you can set randomized next sprite step. For example: Sprite{ name: "still" source: "content/BearSheet.png" frameCount: 1 frameWidth: 256 frameHeight: 256 frameDuration: 100 to: {"still":0.9, "blink":0.1, "floating":0} } In this Sprite after finish in 1/10 times Sprite named blink will be rendered and in 9/10 times this Sprite will be repeated. For more details aboud sequence you can read the example that I posted in past.
  • QML does not recognize ENUM returned by C++ Q_INVOKABLE function

    Unsolved
    2
    0 評價
    2 貼文
    899 瀏覽
    L
    As far as I know, "Unit" type need to register throgh qmlRegisterType to make "Unit::Category" visible in QML.
  • How to get data from SQLite to bidding tableview (QML)

    Unsolved qml binding qml
    4
    0 評價
    4 貼文
    2k 瀏覽
    H
    The TableView gets the data by the data(.....) - Methode to indicate the data is changed, the dataChanged(..) signal should be emitted.
  • Draw an OpenGL scene behind a Qt Quick view

    2
    0 評價
    2 貼文
    1k 瀏覽
    S
    @02JanDal said: QOpenGLBuffer I think you are mixing QOpenGLBuffer with the regular OpenGl buffers. I am new too though so I can't help fix it yet!
  • 此主題已被刪除!

    Unsolved
    2
    0 評價
    2 貼文
    531 瀏覽
  • SoundEffect change source

    Unsolved
    8
    0 評價
    8 貼文
    2k 瀏覽
    U
    Still happens with Qt 5.5.1 Linux. Added Comment to the bug report to that respect.
  • Is QML full strongly typed?

    Unsolved type safety strongly typed typeconsistence qml types
    7
    0 評價
    7 貼文
    4k 瀏覽
    F
    I assumed, dynamic or static type-checking would be also a property to determine whether the language is strong typed or not, at last. So its written in Wikipedia: In fact, many of these are more accurately understood as the presence or absence of type safety, memory safety, static type-checking, or dynamic type-checking. And Cardelli/Wegner uses this property to argue about strongly typing. The words "static typing" and "dynamic typing" are always clearly defined in this context. Why do you wish to determine whether QML is strongly or weakly typed? First I see the definition of typing discipline in Wikipedia about QML: dynamic, strong (https://en.wikipedia.org/wiki/QML), but there is no statement, why QML should be strong. Then I did research and read the article in Stackoverflow about "Is JavaScript an untyped language?" (http://stackoverflow.com/questions/964910/is-javascript-an-untyped-language) and the explanations of Cardelli. At last I was very confused about this. :/ It seemed to be something that can be defined precisely, like the top of a house, whether the roofing tiles are red or not red. Do you think C++ is strongly or weakly typed? Yes, you are right.... when I assign "hello" to c3 it works, too... Probably there is no clear differentiation between "strong" and "weak", instead of this it should be graded whether a language is stronger/weaker than another one. For instance C++ is stronger typed than JavaScript but weaker than Haskell.
  • Can not import components

    5
    0 評價
    5 貼文
    5k 瀏覽
    B
    @Balamurali said: hi this is balamurali I'm just a beginner in Qt creator . now working on speedometer recreation. my qml code is import QtQuick 2.3 import QtQuick.Window 2.2 import QtMobility.publishsubscribe 1.1 import "../Components" Item { id: root property int viewid: -1 property int analogindex: -1 property int topindex: -1 property int bottomindex: -1 signal clicked() signal options() function toFixed(num,count) { var s = num.toFixed(count).toString(); return s; } MouseHandler { id: mouseHandler anchors.fill: parent onSingleTap: root.clicked() onLongTap: root.reset() onDoubleTap: root.options() } function update() { analogindex = settings.getProperty("speed_analog",0) topindex = settings.getProperty("speed_top",3) bottomindex = settings.getProperty("speed_bottom",4) } Component.onCompleted: update() property list<QtObject> values: [ ValueSpaceSubscriber { id: speedcur; path: "/server/speed/current" }, ValueSpaceSubscriber { id: speedmin; path: "/server/speed/min" }, ValueSpaceSubscriber { id: speedmax; path: "/server/speed/max" }, ValueSpaceSubscriber { id: speedavg; path: "/server/speed/average" }, ValueSpaceSubscriber { id: distance; path: "/server/location/distance" }, ValueSpaceSubscriber { id: monitor; path: "/server/monitor/distance" } ] property double analogvalue: values[analogindex].value? values[analogindex].value : -180 property double topvalue: values[topindex].value? values[topindex].value : 0 property double bottomvalue: values[bottomindex].value? values[bottomindex].value : 0 function reset() { console.log("speedometer.reset()") var cmd = { "class": "speed", "method": "reset", "args": [] } client.sendCommand(cmd); cmd = { "class": "location", "method": "reset", "args": [] } client.sendCommand(cmd); } property int count: 5 onCountChanged: setCount(count) function setCount(c) { console.log("speedometer.setCount(",c,")") var cmd = { "class": "speed", "method": "setcount", "args": [ c ] } client.sendCommand(cmd); } property real hysteresis: 25.0 onHysteresisChanged: setHysteresis(hysteresis) function setHysteresis(h) { console.log("speedometer.setHysteresis(",h,")") var cmd = { "class": "location", "method": "sethysteresis", "args": [ h ] } client.sendCommand(cmd); } Image { //source: if (analog.value < 10) "speed10.svg"; else "speed200.svg" source: (analogvalue && (analogvalue>10))? "../Images/speed200.svg" : "../Images/speed10.svg" width: parent.width height: parent.height } Rectangle { y: parent.height * 0.75 height: parent.height * 0.16 color: activePalette.dark width: parent.width/4 anchors.horizontalCenter: parent.horizontalCenter Text { //id: top anchors.top: parent.top anchors.right: parent.right anchors.margins: 2 //text: root.toFixed(top.value,1) text: root.toFixed(topvalue,1) color: "white" font.bold: true; font.pixelSize: parent.height/3 style: Text.Raised; styleColor: "black" } Text { //id: bottom anchors.bottom: parent.bottom anchors.right: parent.right anchors.margins: 2 //text: root.toFixed(bottom.value,1) text: root.toFixed(bottomvalue,1) color: "white" font.bold: true; font.pixelSize: parent.height/3 style: Text.Raised; styleColor: "black" } } Image { source: "../Images/speedneedle.svg" width: parent.width height: parent.height transform: Rotation { id: needle origin.x: width/2 origin.y: height/2 //angle: if (analog.value < 10) analog.value/10*360 -180; else analog.value/200*360 -180 angle: analogvalue<10? analogvalue/10*360 -180: analogvalue/200*360 -180 Behavior on angle { SpringAnimation { spring: 1.4 damping: .15 } } } } } and I'm getting error as QQmlApplicationEngine failed to load component qrc:/main.qml:4 "../Components": no such directory kindly help me Thanks in Advance
  • Expected token

    qml
    10
    0 評價
    10 貼文
    6k 瀏覽
    E
    Ok, I found the answer! It works with Component.onCompleted: {musicplay()} Greetings elmoterich
  • 0 評價
    6 貼文
    2k 瀏覽
    p3c0P
    @Amey As @xargs1 pointed out those signals are only emitted on users interaction. Another workaround is to make use of contentY property and thus the onContentYChanged handler. It will be called in all cases. To detect if the movement has stopped you can put a condition to check current contentY with a pre-calculated value based on index and delegate's height.
  • QList<QObject *> data model roles in QML. Ok in example and not Ok in real life.

    Unsolved
    2
    0 評價
    2 貼文
    1k 瀏覽
    p3c0P
    @Kofr AFAIK It works in ListView's delegate only because properties of model are made available for it. It won't work outside of the delegate and thus in case of ComboBox modelData wont work. To access the model data you can use get (for ListModel ) and passing it in your case currentIndex. For C++ model you can write your own Q_INVOKABLE function.
  • Mixing Qt Quick Controls 1.x and 2.x

    qtquick.control
    3
    0 評價
    3 貼文
    3k 瀏覽
    H
    Thanks! Good to know that this should work.
  • Get List Properties from QML in C++

    qml qqmllistpropert c++ list of objects
    2
    0 評價
    2 貼文
    2k 瀏覽
    p3c0P
    Hi @Kofr Check out this example especially this file. There you can use findChild instead to find Converter and then get the data in the same way.
  • TreeView parent to child link in view field

    treeview qml
    5
    0 評價
    5 貼文
    3k 瀏覽
    R
    @Citron Thanks for you reply.. i have done it. import QtQuick 2.5 import QtQuick.Controls 1.4 as QControls import QtQuick.Controls.Styles 1.4 import OrmcoUI.Controls 1.0 TreeViewStyle{id: styleId; backgroundColor: "transparent" indentation: 20 itemDelegate: checkBoxDelegate; branchDelegate: branchDelegateId property variant linkDepthArray:[0] property int linkWidth: 0 property int linkHeight: 0 property color linkColor: "#5F5F5F" Component {id: branchDelegateId Item {id: branchItemId; x: -5; width: 12; height: 12; Rectangle {anchors.fill: parent; color: "transparent"; Image{anchors.fill : parent source: styleData.isExpanded ? "qrc:/minus.png" : "qrc:/plus.png" } Component.onCompleted: { linkDepthArray[styleData.depth] = x - width; linkWidth = width; linkHeight = height; } } } } Component { id: checkBoxDelegate Item { GQITreeViewItem{anchors.fill: parent; branchHeight: linkHeight; branchWidth: linkWidth; treeModel: control.model; depthArray: linkDepthArray; index: styleData.index; widthOffset: indentation } } } // Component { // id: checkBoxDelegate // Item { // id: container; // property int offset: (height - branchHeight) / 2.0 // GQICheckBox{id: checkBox; anchors.verticalCenter : container.verticalCenter // checkedState: styleData.value; // text: control.model.GetText(styleData.index); // onClicked: // { // console.log("value", styleData.value) // console.log("Checked index", styleData.index) // control.model.SetData(checked, styleData.index); // } // Component.onCompleted: { // updateLine(control.model.GetDepth(styleData.index)); // //console.log("Checked height", container.height) // } // } // property Item rectItem // function updateLine(depth){ // for (var i=0; i<depth; i++){ // var posX = depthArray[i] - (i+1) * indentation // var drawLine = true; // if(i > 0 && control.model.IsLastElement(styleData.index, i)) // drawLine = false; // if(drawLine) // { // rectItem = linkComponentId.createObject(container); // rectItem.x = posX; rectItem.height = (i+1) * container.height; // if(control.model.IsFirstElement(styleData.index)){ // rectItem.y = -offset; rectItem.height += offset; // } // //to restrict height of rectangle // if(control.model.IsLastElement(styleData.index)) // rectItem.height = (rectItem.height - rectItem.y) / 2.0; // } // if(i == 0){ // rectItem = linkComponentId.createObject(container); // rectItem.x = posX; rectItem.width = container.x - posX - 5; // rectItem.height = 1; rectItem.y = container.height / 2.0; // if(control.model.IsParentNode(styleData.index)) // rectItem.width = indentation - (branchWidth / 2.0) + 2; // } // } // } // Component {id: linkComponentId // Item {id: linkRectId; // width: 1; height: container.height; // Rectangle{ // anchors.fill: parent; // color: linkColor; // } // } // } // } // } }
  • Scope in QML

    scope qml quick signals slots signalsslots
    3
    0 評價
    3 貼文
    2k 瀏覽
    A
    @JKSH Thanks for your help, May you help me more by writing a sample code for this ? Thanks
  • Partially transparent image

    image transparent embedded qt quick
    4
    0 評價
    4 貼文
    3k 瀏覽
    p3c0P
    @jimmy274 You're Welcome :) A more interesting way but through C++ would be to use QQuickPaintedItem to create your own custom item. You can re-implement paint method to draw your custom shapes, text etc.. It uses QPainter to achieve this. Try looking for setCompositionMode and setClipRegion methods. An example for QQuickPaintedItem is here.