Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • QtQuick Control Q_INVOKABLE returning null

    5
    0 Votes
    5 Posts
    2k Views
    J
    Replying to share my personal experience with this issue. Changing the ownership of the instantiated object to "QQmlEngine::CppOwnership":http://doc.qt.io/qt-5/qqmlengine.html#ObjectOwnership-enum before returning it indeed fixes the issue. What is not very intuitive though is the fact that you have to change the ownership to CppOwnership even if the objectOwnership() method already returns CppOwnership. This gives something like: @QObject * MyClass::InvokableMethod ( ... ) { QObject * pObject = InstanciateObject( ... ); QQmlEngine::ObjectOwnership ow = engine->objectOwnership( pObject ); // Here, ow == QQmlEngine::CppOwnership engine->setObjectOwnership( pObject, QQmlEngine::CppOwnership ); return pObject; }@ The "setObjectOwnership()":http://doc.qt.io/qt-5/qqmlengine.html#setObjectOwnership and "objectOwnership()":http://doc.qt.io/qt-5/qqmlengine.html#objectOwnership methods seem to perform more stuff than just set and get a two-value property on the object, something that does not appear in the documentation. Anyway, thanks for the post.
  • ListView is not shown

    5
    0 Votes
    5 Posts
    1k Views
    P
    Try changing to... @Window { id: root width: 200 height: 200@ or maybe set/use the minimum/maximum width and height properties IDK but I think if you don't set the properties, they may default to 0
  • QQuickWidget is blank on other computers

    4
    0 Votes
    4 Posts
    1k Views
    JKSHJ
    [quote author="ondrejandrej" date="1421762292"]Can I avoid copying those files e. g. by adding them to resources?[/quote]Interesting idea; I've never tried putting official files in a resource before. You could try it, but I'm not sure if the LGPL license allows that. If you have the "Professional license":http://www.qt.io/download/ you could use the Qt Quick Compiler to convert your QML source code into your program binaries.
  • Embed QML Item in QWidget

    4
    0 Votes
    4 Posts
    3k Views
    JKSHJ
    Hi, QDeclarativeView is for Qt Quick 1. These are old technologies which are now deprecated. Use QQuickWidget + Qt Quick 2 instead. See "Porting QML Applications to Qt 5":http://doc.qt.io/qt-5/qtquick-porting-qt5.html for more info.
  • Where did the QSGRenderThread go ? (Qt5.4 - Xcode 6 Instruments)

    2
    0 Votes
    2 Posts
    1k Views
    JKSHJ
    Hi, I don't know why, but the Qt engineers do. You can find them at the "Interest mailing list":http://lists.qt-project.org/mailman/listinfo/interest (You need to subscribe first)
  • Error Quick

    3
    0 Votes
    3 Posts
    813 Views
    T
    yes, install apt-get install xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core [quote author="sierdzio" date="1421827439"]Do you have OpenGL drivers installed?[/quote]
  • Cannot assign object to list [SOLVED]

    4
    0 Votes
    4 Posts
    4k Views
    S
    Once again I shoot myself in the foot. I'm posting this for the benefit of everyone else since it was such a stupid thing that I did: qRegisterMetaType<QObject*>("QQuickitemLayer"); What's going on here (as far as I can tell) is that QObject* was bound to the name QQuickItemLayer in the Qt Meta Object system. The issue with this is that the subsequent QML elements are registered also using these same types. I know this is a vague explanation- but it boils down to the meta type system. Taking this line out in my code fixed the issue I was seeing. I'm writing a blogpost elsewhere to fully explain some of the things I tried since a lot of it is off topic. The reason I put this line of code in was that the QmlEngine was reporting that this was an issue in a console app. I thought I was being clever by providing this type (it silenced the console errors). However, it just caused a bigger issue.
  • A Hellow World compiled in Qt5.4 for android takes 15s to open

    1
    0 Votes
    1 Posts
    403 Views
    No one has replied
  • How to handle keys in Qt Quick Controls application

    2
    0 Votes
    2 Posts
    551 Views
    p3c0P
    Hi, You can add Item to ApplicationWindow and then use Keys.onBackPressed in it. Keep focus on this Item.
  • The Qt Scene Graph uses AoS to organize buffer data, why not SoA?

    2
    0 Votes
    2 Posts
    703 Views
    SGaistS
    Hi, For that kind of questions you shoud rather go to the interest mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented) the #qt IRC channel can also be a good place to discuss this
  • 0 Votes
    12 Posts
    7k Views
    shavS
    I glad to help you with your problem. If your problem was fix please mark thread as SOLVED.
  • [SOLVED] How use pathElement in function

    5
    0 Votes
    5 Posts
    2k Views
    p3c0P
    Right :) Still adhered to the old style ;)
  • [SOLVED] Loader and MouseArea issues.

    7
    0 Votes
    7 Posts
    3k Views
    p3c0P
    You're Welcome :) Happy Coding..
  • Pass Camera preview from QML to C++

    2
    0 Votes
    2 Posts
    2k Views
    C
    Hi, what exactly went wrong ? I used C++ QCamera(and all related) from QML and everything is working properly, but I didn't try to find camera object from qml root. Instead I create a property in C++ class, expose it to qml, and from qml assign the camera object to that C++ property.
  • Creating an Alias for a QML Type Member

    4
    0 Votes
    4 Posts
    1k Views
    p3c0P
    bq. Is it possible to create a property alias for “label”? I guess it won't work as the Component which it refers to would not have been initiated. If your purpose is to dynamically change the label's component you can create a property Component and the assign it a Component when you call it. eg: @ MyButton.qml Item { property Component myComp Button { style: ButtonStyle { id: styleLabel label: myComp background: Rectangle { ... } } } } Main.qml MyButton { myComp: Qt.createComponent("labelDelegate1.qml") } MyButton { myComp: Qt.createComponent("labelDelegate2.qml") } @ Hope this helps...
  • Transition animation not working

    3
    0 Votes
    3 Posts
    752 Views
    dheerendraD
    For every animation you need to tell which which property you would like animate. If you want the animation to triggered by default, you can Behaviour on <x> {} e.g @Rectangle { id: rect width: 100; height: 100 color: "red" Behavior on x { NumberAnimation { duration: 1000 } } MouseArea { anchors.fill: parent onClicked: rect.width = 50 } }@
  • Command pattern with QML

    3
    0 Votes
    3 Posts
    1k Views
    dheerendraD
    Did you get a chance to look at how to integrate C++ and QML ? QtAssistant provides good examples for this integration. You will be able to solve your issue.
  • No memory release on ListView

    3
    0 Votes
    3 Posts
    734 Views
    A
    Thanks ustulation. I tryied running QJSEngine::collectGarbage() and it didn't release memory. Any ideas ?
  • QQuickView or QQmlApplicationEngine or QQuickWidget

    2
    0 Votes
    2 Posts
    2k Views
    JKSHJ
    Hi, Start by reading "this thread":http://qt-project.org/forums/viewthread/49581 Use QQuickWidget if (and only if) you want to integrate your QML GUI into a C++ QWidget-based GUI. Post back if you'd like anything clarified. [quote author="ustulation" date="1421583894"]For eg., In my QQuickView derivative I could easily handle the events by overriding the appropriate virtuals. Don't know if that would be possible/convenient for QQmlApplicationEngine approach, etc.[/quote]What kind of events do you mean?
  • How-to make grid-like customizable UI

    3
    0 Votes
    3 Posts
    719 Views
    M
    It looks like GridView not intended to display items with different size (width/height).