Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • 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
    982 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
    732 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....>"<
  • 0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi, I'm not sure I fully understand your situation. Could you post a sample code that illustrate your question ?
  • How to run te application with QtQuick.Controls?

    5
    0 Votes
    5 Posts
    2k Views
    B
    I run the ApplicationTemplate. There are some warnings and the bq. import QtQuick.Layouts 1.0 is underlined (errors during typeinfo files reading), but it works. My test app also works but I had to remove qmlapplicaionviewer folder and copy the main.cpp and .pro file from the example. When I switch into the design mode QtCreator just dies. But at least in Edit mode it's working. So thank you, thank you, thank you! :) Edit: maybe it doesn't work well.. QtCreator slowed down and often dosn't answer. The MenuBar is underlined (Could not resolve the prototype 'MenuBarPrivate' of 'MenuBar' (M301) ), but it builds the application.
  • Is it possible to move a QML application offscreen?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Could not initialize GLX

    2
    0 Votes
    2 Posts
    5k Views
    D
    I'm still not further, but I have verified that I can run the mesa demos, e.g. glxgears, although very slow. This means opengl is working correctly, right? Does nobody have an idea why the QtQuick app won't run?
  • Media PLayer Shared Volumen ?

    2
    0 Votes
    2 Posts
    890 Views
    A
    any answer?, please
  • 0 Votes
    5 Posts
    14k Views
    JKSHJ
    Yes, all QDeclarative* classes have been renamed to either QQuick* classes or QQml* classes. See this "porting guide":http://qt-project.org/doc/qt-5.0/qtquick/qtquick-porting-qt5.html#c-code for a full list. Qt Quick 1 was a new technology and has many limitations as you've found, so the Qt developers redesigned it to produce Qt Quick 2. Qt Quick 1 is now deprecated. Qt Quick Controls brings QWidget-like components to QML (see http://blog.qt.digia.com/blog/2012/06/06/desktop-components-for-qt-5/ ) It will be released with Qt 5.1, which has its beta is scheduled to be ready in a few more weeks. Unfortunately there's no way to incorporate Qt Quick 2 components directly in the Forms window yet. If you want, you can use the bug report's suggestions as a workaround: Create a custom "QWidget which takes a QQuickView":http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/ and then "promote":http://qt-project.org/doc/qt-4.8/designer-using-custom-widgets.html#promoting-widgets that widget in your Form.
  • Preprocessor macros

    7
    0 Votes
    7 Posts
    3k Views
    C
    And you have "QT += qml quick qml-private quick-private" in your .pro? You may also need the v8-private (I think that's module name for qmake's purposes, it might be jsbackend-private I don't remember) but I don't really know.