[Interest] How to set a non-global context property for a single QQmlComponent?
patrickkidd at gmail.com
Wed Jul 17 12:15:23 CEST 2019
Is there any way other than QQuickWidget to show a Qml Component in a QWidget?
> On Jul 17, 2019, at 2:14 AM, Sérgio Martins <sergio.martins at kdab.com> wrote:
> On 2019-07-17 10:58, Patrick Stinson wrote:
>> Shoot, you know at first pass it looks like that will work. Wow.
>> I wonder if this is possible to do with QQuickWidget? Or if not how to
>> show a component into a QWidget without QQuickWidget?
> According to  it's not possible, but could be an easy patch to add to QQuickWidget's API.
>  https://code.woboq.org/qt5/qtdeclarative/src/quickwidgets/qquickwidget.cpp.html#1049
>>> On Jul 17, 2019, at 1:35 AM, Sérgio Martins <sergio.martins at kdab.com> wrote:
>>> On 2019-07-17 10:15, Patrick Stinson wrote:
>>>> Surely there must be a way to set a context property on a single
>>>> component without having to set it globally on the entire QQmlEngine?
>>>> Indeed, the QQmlContext documentation is silent on this point.
>>> You can create a child QQmlContext via this constructor , and then pass it to QQmlComponent::create()
>>>  - https://doc.qt.io/qt-5/qqmlcontext.html#QQmlContext-1
> Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
> Klarälvdalens Datakonsult AB, a KDAB Group company
> Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
> KDAB - The Qt, C++ and OpenGL Experts
More information about the Interest