Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • QML Shaders

    2
    0 Votes
    2 Posts
    1k Views
    V
    I suggest you try this simple "example":http://doc-snapshot.qt-project.org/qdoc/qml-qtquick-shadereffect.html first. and then try other examples. @ import QtQuick 2.0 Rectangle { width: 200; height: 100 Row { Image { id: img; sourceSize { width: 100; height: 100 } source: "qt-logo.png" } ShaderEffect { width: 100; height: 100 property variant src: img vertexShader: " uniform highp mat4 qt_Matrix; attribute highp vec4 qt_Vertex; attribute highp vec2 qt_MultiTexCoord0; varying highp vec2 coord; void main() { coord = qt_MultiTexCoord0; gl_Position = qt_Matrix * qt_Vertex; }" fragmentShader: " varying highp vec2 coord; uniform sampler2D src; uniform lowp float qt_Opacity; void main() { lowp vec4 tex = texture2D(src, coord); gl_FragColor = vec4(vec3(dot(tex.rgb, vec3(0.344, 0.5, 0.156))), tex.a) * qt_Opacity; }" } } } @
  • Change implementation according to different platform

    2
    0 Votes
    2 Posts
    592 Views
    V
    "Overview of the new features in Qt Quick":http://blog.qt.digia.com/blog/2013/06/21/overview-of-the-new-features-in-qt-quick/ bq. Jens Bache-Wiig says: June 21, 2013 at 22:26 Sure for instance: anchors.margins: Qt.platform.os === "mac" ? 12 : 4 Alternatively you can use this in a loader to load different files based on platform.
  • What is the associate type of QList<QPair<double, QString>> in qml?

    4
    0 Votes
    4 Posts
    4k Views
    V
    You can return QVariantList, "QVariantList and QVariantMap to JavaScript Array and Object":http://qt-project.org/doc/qt-5/qtqml-cppintegration-data.html
  • I have a question about rectangle, thanka!

    4
    0 Votes
    4 Posts
    1k Views
    p3c0P
    Well then you can use the "contentItem":http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-flickable.html#contentItem-prop and get the childrens and then access its x and y. E.g @ listview.contentItem.children[1].x listview.contentItem.children[1].y @ This gives the item a index 1 in ListView.
  • [Solved]WebView has Weird question on Qt 5 (size problem)

    2
    0 Votes
    2 Posts
    2k Views
    H
    it turns out it's all because of my dropshadow code like this: @ DropShadow { id: rectShadow; anchors.fill: source cached: true; verticalOffset: 0; radius: 8.0; samples: 16; color: "#80000000"; smooth: true; source: container; } @ I have drawn a shadow around the container(window),webview was in within the window of course,so I still don't know why it's happened,but I can resolve it by simply comment these codes,it works fine now. Thanks to my rubber duck
  • QML QtContacts 5.0

    1
    0 Votes
    1 Posts
    588 Views
    No one has replied
  • 0 Votes
    2 Posts
    2k Views
    S
    Found the solution, use loader to load the ComboBox when insert or "Your text to link here...":http://stackoverflow.com/questions/20833809/initialize-error-of-combobox-cannot-read-property-constructor-of-undefined#comment31247640_20833809
  • How to convert double type in to complex <double>

    1
    0 Votes
    1 Posts
    910 Views
    No one has replied
  • Binding loop detected for property "width" when I add 20 to width

    3
    0 Votes
    3 Posts
    2k Views
    W
    Thanks, but childrenRect.width can (should) not change because it is not dependant on its parents width. If it were then we would have a binding loop.
  • How to set property into a sub context?

    3
    1 Votes
    3 Posts
    4k Views
    V
    Ok, I found: @ QQmlContext *context1 = new QQmlContext(engine, qApp); context1->setContextProperty("myList", modelList_1 ); QQmlComponent component1(engine, QUrl::fromLocalFile("myScene.qml"), this); QObject object1 = component1.beginCreate( context1 ); qobject_cast<QQuickItem>(object1)->setParentItem( window1 ); component1.completeCreate(); QQmlContext *context2 = new QQmlContext(engine, qApp); context2->setContextProperty("myList", modeList_2 ); QQmlComponent component2(engine, QUrl::fromLocalFile&#40;"myScene.qml"&#41;, this&#41;; QObject *object2 = component2.beginCreate( context2 ); qobject_cast<QQuickItem*>(object2)->setParentItem( window2 ); component2.completeCreate(); QQmlContext *context3 = new QQmlContext(engine, qApp); context3->setContextProperty("myList", modelList_3 ); QQmlComponent component3(engine, QUrl::fromLocalFile&#40;"myScene.qml"&#41;, this&#41;; QObject *object3 = component3.beginCreate( context3 ); qobject_cast<QQuickItem*>(object3)->setParentItem( window3 ); component3.completeCreate(); @ So, I don't have of name conflict (each scene uses "myList" model name, but shows differents data). But why it isn't possible to set property into internal context? There is an explication?
  • Define ListElement at an external file

    2
    0 Votes
    2 Posts
    941 Views
    V
    @ import QtQuick 2.0 ListModel { dynamicRoles: true ListElement { someitems:[ ListElement{ recordID: Math.round(Math.random()*1000) eqType: 0 message: "some text" }, ListElement{ recordID: Math.round(Math.random()*1000) eqType: 0 message: "some text" }, ListElement{ recordID: Math.round(Math.random()*1000) eqType: 0 message: "some text" } ] } } @
  • QtQuick 2.0 Two listviews and mouse

    2
    0 Votes
    2 Posts
    867 Views
    B
    Problem fixed, i had to delete anchors.fill: parent from Listview1 and Listview2 :)
  • Qt5.0 or newer-- how to create a transparent window use qml

    4
    0 Votes
    4 Posts
    1k Views
    V
    color: "#00000000" // ARGB fully transparent
  • Incorrect documentation on DragEvent

    1
    0 Votes
    1 Posts
    560 Views
    No one has replied
  • Module QtAudioEngine is not installed

    3
    0 Votes
    3 Posts
    3k Views
    M
    Thanks for answer, I solved this problem, I using qt for android apps, and now qt doesn't support audio engine for android,
  • How can i create a ios-style pageview?

    4
    0 Votes
    4 Posts
    4k Views
    V
    Did you use "StackView":http://qt-project.org/doc/qt-5/qml-qtquick-controls-stackview.html ?
  • Qt Quick 2 and Windows XP

    5
    0 Votes
    5 Posts
    3k Views
    S
    [quote author="ThomasHartmann" date="1387619330"]I recently did some research about using llvmpipe for Qt Quick 2 on Windows. So far it looks very promising. Performance is reasonable and even the shader examples run. Here are the instructions how to build llvmpipe on Windows: https://sites.google.com/site/buildllvmpipe/ llvmpipe on Windows is basically another opengl32.dll that you have to use instead of the system one. I would recommend renaming it though, to make sure your application uses the correct dll in all cases. [/quote] any prebuild dll for win7 and winXP?Besides, where should we place the dll?What name should we give the dll if we want to rename it?Thanks
  • How to resize QQuickView?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • [solved] Collision detect of items doesn't work or suported in Quick 2.0!

    2
    0 Votes
    2 Posts
    1k Views
    J
    See https://bugreports.qt-project.org/browse/QTBUG-34712 It a bug in Item.contains() :-(
  • Get 3D coordinate of mouse position from onClicked in QML

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied