Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • 0 Votes
    13 Posts
    4k Views
    jeremy_kJ
    A ListView appears to be a better match than the more complicated GridLayout and Repeater. ListView { delegate: Item { width: ListView.view.width height: childrenRect.height Text { anchors.right: parent.horizontalCenter text: modelData.firstPart + ":" } Text { anchors.left: parent.horizontalCenter text: modelData.secondPart } } }
  • Dynamic Qt Quick 3D creation and deletion

    Solved qt quick 3d
    5
    0 Votes
    5 Posts
    1k Views
    Q
    The code in my previous post works in some cases but additional conditions must also be met. I eliminated crashes, I think, in Qt 6.1.2 with the following: A buffer to prevent deletion of the View3D in the code above is required. The parent hierarchy of the View3D must not have a null parent. Creating an Item with a null parent, adding a View3D, and then settings the item's parent can lead to a crash. Visibility is important. If adding a View3D to an Item, it seems best to create/add a View3D when the item becomes visible. I'm also releasing the view when the item becomes invisible. This seems to keep Qt happy and so far the crashes are gone.
  • connection to emitter, doesn't affect QML elements

    Moved Unsolved
    3
    0 Votes
    3 Posts
    267 Views
    S
    Thank you very much for the reply, the question was partially solved. Now I post one other but, in according to your reply, more detailed. Thanks again for the reply.
  • tabview with dynamic tabs

    Unsolved
    1
    0 Votes
    1 Posts
    235 Views
    No one has replied
  • "QOpenGLFramebufferObject: Framebuffer incomplete attachment" In "repeated" ChartView

    Unsolved
    2
    1 Votes
    2 Posts
    1k Views
    6thC6
    Does it still happen after you ditch all the layouts? I'd cut away until you find the component doing it first.
  • QQuickWindow:renderTargetId() replacement in Qt 6.0?

    Unsolved
    1
    0 Votes
    1 Posts
    180 Views
    No one has replied
  • Qml button color excessive animation style

    Unsolved
    2
    0 Votes
    2 Posts
    318 Views
    CP71C
    @Nan-Feng Hi, remember, I'm not a qml developer, so more I can’t help you, sorry! :( But this link can help you https://doc.qt.io/qt-5/qtquick-statesanimations-animations.html Only to start, chenk my code well, it is only a test: import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Button { id: button x: 44 y: 45 width: 166 height: 69 text: qsTr("Button") background: Rectangle { id: rect color: "blue" states: [ State { name: "change"; when: button.pressed PropertyChanges { target: rect; color: "blue" } } ] transitions: Transition { ColorAnimation { to: "red"; duration: 1000 } } } } }
  • Align text in the middle of nested layouts

    Unsolved columnlayout rowlayout text center nested
    7
    0 Votes
    7 Posts
    2k Views
    K
    @raven-worx i cannot specify Layout.alignment in string creating Text because i get error that this property doesn't exist
  • Error while qmlRegisterType with multiple inheritance class

    Solved
    5
    0 Votes
    5 Posts
    544 Views
    Y
    I discard QQuickPaintedItem and using updatePaintNode with QImage and QSGTexture. The idea from https://stackoverflow.com/a/58597344/5902108 Below is my code. QSGNode* Box::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) { QImage canvas(View::width(), View::height(), QImage::Format_ARGB32); QBrush brush; canvas.fill(QColor("transparent")); QPainter painter(&canvas); brush.setStyle(Qt::SolidPattern); brush.setColor(this->color()); painter.setPen(Qt::NoPen); painter.setBrush(brush); painter.drawRect(0, 0, View::width(), View::height()); QSGTexture *texture = this->window()->createTextureFromImage(canvas); QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode*>(oldNode); if (!node) { node = new QSGSimpleTextureNode(); } node->setRect(0, 0, View::width(), View::height()); node->setTexture(texture); return node; }
  • dynamic Text in Rectangle

    Unsolved
    3
    0 Votes
    3 Posts
    407 Views
    R
    yes, i need to change text, i know is not possible to refer it by ID
  • Save and restore anchors.

    Unsolved qml anchors
    2
    0 Votes
    2 Posts
    258 Views
    MarkkyboyM
    Without seeing any of your code, I would guess for you to try with https://doc.qt.io/qt-5/qml-qtquick-state.html For quicker, better quality results, always post working snippets of your code if you can!
  • How to emit a keyspress signal ?

    Unsolved
    3
    0 Votes
    3 Posts
    314 Views
    V
    @6thC Because I'm using PC and wanna test the Gestures. I want to emit a "Pinch" signal by using the wheel on mouse.
  • FileDialog not rendering after porting from 5.9 to 5.12

    Unsolved filedialog linux render
    1
    0 Votes
    1 Posts
    397 Views
    No one has replied
  • Get the current page of stackView?

    Unsolved
    2
    0 Votes
    2 Posts
    253 Views
    KroMignonK
    @Nan-Feng said in Get the current page of stackView?: Hello, I switch the content in the stackview through the button event, so I define two components and use id as the unique identifier. But I want to get whether the current page is a certain page when the button is clicked, and if it is, I won’t switch it. So is the current page content obtained through view or currentItem? When obtaining future content and comparing components, should it be compared with the component id or with what to determine whether it is a certain component? (Actually, where does the following if statement compare with the current content of the stackview and the component? ID?) I think you are mixing up something. With Component, you are creating a new component type inside the current QML file. Like you would do it with an external QML file. But StackView.currentItem is an instance of a component. => You are trying to compare potatoes and oranges ;) You can do it by creating an instance of component license or by comparing component type.
  • Send singal in eventFilter

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    jsulmJ
    @Knj-Tkm @J-Hilk said in Send singal in eventFilter: you have 2 Event instances, one in MyWidget and one in Connect So, my assumption was correct...
  • ListModel deleteing model Object ?

    Solved
    2
    0 Votes
    2 Posts
    264 Views
    P
    i'm thinking it comes down to this.. https://doc.qt.io/qt-5/qtqml-cppintegration-data.html when a QObject is returned from an explicit C++ method call [...] the QML engine assumes ownership of the object. Additionally, the QML engine respects the normal QObject parent ownership semantics of Qt C++ objects, and will never delete a QObject instance which has a parent. So if the engine assumes ownership, then in C++land you can't assume that object is good anymore. So before returning any QObject to QML, make sure the parent is set.
  • Setter function for internal qml object

    Solved
    3
    0 Votes
    3 Posts
    300 Views
    M
    Thanks for your answer ^^ I totally forgot the existance of alias ! Thank you for the remind ^^
  • Settings loading after PositionSource instantiated, wrong PluginParameter value passed

    Unsolved
    1
    0 Votes
    1 Posts
    144 Views
    No one has replied
  • Pinch zoom on a 3D object in Qml.

    Unsolved
    1
    0 Votes
    1 Posts
    297 Views
    No one has replied
  • Popup and Slider

    Solved
    3
    0 Votes
    3 Posts
    454 Views
    T
    thanks. your solution worked but not exactly the way I wanted. I would like to try and get ideas.