Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.1k Posts
  • 0 Votes
    3 Posts
    3k Views
    R
    Thank you, JapieKrekel, I did it and now it works fine! Program starts faster than before (but unfortunately slower than Qt Widgets application) and after changes I have to only press “Run”. I have one problem: I used Qt Fusion Style, not system style. How can I do this with qmlscene? I created "separate thread":https://qt-project.org/forums/viewthread/27602/ for this question.
  • 0 Votes
    1 Posts
    812 Views
    No one has replied
  • [SOLVED] Loading pure QML plugin from shared library and Qt Creator

    2
    0 Votes
    2 Posts
    2k Views
    D
    This is little old post, but can you please give some code example how did you made it? I am having same problem, but I am unable to solve it yet... This is thread: "http://qt-project.org/forums/viewthread/27538/":http://qt-project.org/forums/viewthread/27538/
  • How to install QtQuickControls on Qt 5.0.2?

    5
    0 Votes
    5 Posts
    2k Views
    sierdzioS
    PS. Qt 5.1 beta1 test builds are already online: "link":http://download.qt-project.org/snapshots/qt/5.1/5.1.0-beta1/backups/.
  • Create built-in quick component in C++

    2
    0 Votes
    2 Posts
    1k Views
    sierdzioS
    See "this":http://qt-project.org/doc/qt-4.8/qtbinding.html#loading-qml-components-from-c guide (it's for QtQuick 1, but it works the same in QML2, you just need to change class names).
  • 0 Votes
    2 Posts
    1k Views
    T
    Never mind :), my suggestion was the same as yours.
  • 0 Votes
    3 Posts
    1k Views
    O
    Trying this: @ Rectangle { x: 50 y: 50 width: 100 height: 100 color: "#FFFF0000" Node { x: 80 y: 80 radius: 20 color: "#FFFFCC00" } } @ Still renders Node behind the rectangle... Edit: I just submitted the problem to the QT Bug Tracker: https://bugreports.qt-project.org/browse/QTBUG-31043 Hopefully this will get a high priority and will get fixed soon... -Nik.
  • QML / Cpp plugin

    11
    0 Votes
    11 Posts
    8k Views
    W
    Ok, fine. Thanks a lot !
  • About rendering a QML Item into pixmap

    2
    0 Votes
    2 Posts
    3k Views
    M
    In case someone's interested, here's how I ended up doing this. It was only tested in my own special case where it works, it might not work properly elsewhere. The draw order is important.. anyway: @ void renderItem(QGraphicsItem* item, QPainter* painter, QStyleOptionGraphicsItem* option, const QTransform& baseTransform) { QTransform itemTransform = item->sceneTransform(); itemTransform *= baseTransform; painter->setWorldTransform(itemTransform, false); item->paint(painter, option, NULL); // Recurse into children //TODO this should be breadth-first not depth-first! foreach ( QGraphicsItem* child, item->childItems() ) { renderItem(child, painter, option, baseTransform); } } void Capture::save(QDeclarativeItem* item) { delete m_pixmap; m_pixmap = NULL; m_pixmap = new QPixmap(item->width(), item->height()); QPainter painter(m_pixmap); QStyleOptionGraphicsItem option; // Get the inverse transform of the root item's scene transform; all the // children's transforms will be transformed by this in order to bring // their coordinate systems from the scene space to the root item space QTransform inverse = item->sceneTransform().inverted(); // Recursively render the item and all its children renderItem(item, &painter, &option, inverse); } @ So the beef is that we're grabbing the scene transforms (which indicated how the items are positioned / oriented in relation to the root window/"scene") of each item and setting that to the painter. We're also transforming those transforms by the inverse transform of the root item we're drawing to bring the coordinate systems from the "scene space" into the root item's coordinate space. Matti ps. EDIT: could we please have the annotated code block to always (independent of the browser window width) allow for at least 80 characters per line without wrapping the lines? Would make the code whole lot more readable.
  • QtGraphicalEffects qml files into qrc?

    1
    0 Votes
    1 Posts
    970 Views
    No one has replied
  • Why I can't see the code from The Qt Assistant or qt-project.org/doc

    3
    0 Votes
    3 Posts
    1k Views
    JKSHJ
    Hi chenjie4255, Your browser is ok, but the documentation is broken. It is being fixed now, and you should be able to see the code when Qt 5.1 comes out. For now, you can find the code for that example in <Qt>\examples\quick\tutorials\samegame <Qt> depends on the package you downloaded. For example, the VS 2012 package could be C:\Qt\5.0.2-msvc2012-x64\5.0.2\msvc2012_64\examples\quick\tutorials\samegame
  • QML Gradient Any Direction - SOLVED

    2
    0 Votes
    2 Posts
    3k Views
    W
    Hi, This was exactly what I needed - somehow OpacityMask won't go well with traditional QML gradient+rotation Your Class solved it, thanks! Note: Qt 5.0.2
  • Memory leak while using ListView

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • How to display Chinese in Qt Quick 2.0

    4
    0 Votes
    4 Posts
    1k Views
    R
    Can Qt Linguist solve this problem [quote author="Tobias Hunger" date="1367655751"]Do you have a small example piece of code for us to look at? It is rather hard to provide hints without some code to look at.[/quote]
  • Playing media from another source type

    1
    0 Votes
    1 Posts
    722 Views
    No one has replied
  • [SOLVED] Dynamical aliases or equivalent of C pointers in QML

    2
    0 Votes
    2 Posts
    2k Views
    R
    OK, got it. I forgot that JavaScript assignment is not a data, but a reference copy (I'm a complete novice in JavaScript, only 3 days). So I just needed to make assignment on checkbox checked: @ property var circle: ({ x: 256, y: 256, r: 64 }) property var ellipse: ({ x: 256, y: 256, width: 64, height: 128 }) property var figure: ellipse ... CheckBox { id: chkCircle text: "Circle" checked: false onCheckedChanged: figure = checked? circle : ellipse; } ... figure.x = parseFloat(text); @ This concrete problem is solved, but I still need dynamic aliases and full bindings between QML objects and JavaScript objects.
  • How to develop symbian Belle app using Qt on linux ?

    19
    0 Votes
    19 Posts
    11k Views
    T
    [quote author="Tobias Hunger" date="1367658847"]I am not 100% sure, but I remember reading here that the remote compiler was discontinued. Maybe somebody over at developer.nokia.com knows more?[/quote] I found it: http://www.developer.nokia.com/Community/Wiki/Archived:Qt_SDK_Remote_Compiler The message is clear: The Qt Remote Compiler service has been discontinued. Nokia must not be very interested in people using Linux.
  • Scene graph perspective projection

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Keyboard and mouse does not work together to change the source image

    5
    0 Votes
    5 Posts
    2k Views
    N
    I found the solution... @Rectangle { id: rectangle1 x: 0 y: 0 width: 480 height: 620 color: "#ffffff" //source: "background.png" FocusScope { id: focus_object focus : true property int focus_obj : 1 Image { id: rock x: 5 y: 6 fillMode: Image.PreserveAspectFit smooth: true focus:true source: activeFocus || focus_object.focus_obj == 1 ? "Radiobutton_unselected_highlighted.png" : "Radiobutton_unselected.png" //KeyNavigation.right: pop Keys.onRightPressed: { focus_object.focus_obj = 2 pop.forceActiveFocus() } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { //parent.source = "Radiobutton_unselected_highlighted.png" //parent.focus = true parent.forceActiveFocus() } onExited: { //parent.source : "Radiobutton_unselected.png" switch(focus_object.focus_obj) { case 1: rock.forceActiveFocus() break case 2: pop.forceActiveFocus() break case 3: classic.forceActiveFocus() break } //parent.focus = false } onClicked:{ rock.forceActiveFocus() focus_object.focus_obj = 1 } } } Image { id: pop x: 160 y: 6 width: 64 height: 64 fillMode: Image.PreserveAspectFit smooth: true source: activeFocus || focus_object.focus_obj == 2 ? "Radiobutton_unselected_highlighted.png" : "Radiobutton_unselected.png" //KeyNavigation.left: rock Keys.onLeftPressed: { rock.forceActiveFocus() focus_object.focus_obj = 1 } //KeyNavigation.right: classic Keys.onRightPressed: { classic.forceActiveFocus() focus_object.focus_obj = 3 } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { //parent.source = "Radiobutton_unselected_highlighted.png" //parent.focus = true parent.forceActiveFocus() } onExited: { //parent.source = "Radiobutton_unselected.png" switch(focus_object.focus_obj) { case 1: rock.forceActiveFocus() break case 2: pop.forceActiveFocus() break case 3: classic.forceActiveFocus() break } //parent.focus = false } onClicked:{ pop.forceActiveFocus() focus_object.focus_obj = 2 } } } Image { id: classic x: 306 y: 6 width: 64 height: 64 fillMode: Image.PreserveAspectFit smooth: true source : activeFocus || focus_object.focus_obj == 3 ? "Radiobutton_unselected_highlighted.png" : "Radiobutton_unselected.png" //KeyNavigation.left: pop Keys.onLeftPressed: { pop.forceActiveFocus() focus_object.focus_obj = 2 } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { //if (true == focus) //parent.source = "Radiobutton_unselected_highlighted.png" //classic.foucs = true parent.forceActiveFocus() } onExited: { //parent.source = "Radiobutton_unselected.png" //classic.focus = false switch(focus_object.focus_obj) { case 1: rock.forceActiveFocus() break case 2: pop.forceActiveFocus() break case 3: classic.forceActiveFocus() break } } onClicked:{ classic.forceActiveFocus() focus_object.focus_obj = 3 } }//mouse area }//classic }//Focusscope }@
  • A larger memory leak while using dynamic listmodel?

    2
    0 Votes
    2 Posts
    1k Views
    C
    sorry the code is nothing with dynamic listmodel....>"<