Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • Artifacts on QML Behavior on y only on Linux, not on Win

    Unsolved
    1
    0 Votes
    1 Posts
    118 Views
    No one has replied
  • Using PinchArea and MouseArea on the Canvas element

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    S
    Hello, I've had a similar problem and solved it by storing the mouse position in the onPressed event, but using it only when onPressAndHold and onReleased is called as in the following code example: import QtQuick 2.11 Item { id: root Rectangle { id: drawingArea anchors.fill: parent PinchArea { id: pinchArea anchors.fill: parent property bool isDragging: false pinch { target: pattern dragAxis: Pinch.XAndYAxis } onPinchStarted: pinchArea.isDragging = true onPinchFinished: pinchArea.isDragging = false } // end:PinchArea Rectangle { id: pattern color: 'blue' width: 20 height: 20 x: 10 y: 10 } MouseArea { id: mouseArea property var _initialEvent: undefined enabled: ! pinchArea.isDragging anchors.fill: parent onPressed: _initialEvent = Qt.point(mouse.x, mouse.y) onPressAndHold: doStuff(Qt.point(mouse.x, mouse.y)) onPositionChanged: doStuff(Qt.point(mouse.x, mouse.y)) onReleased: doStuff(Qt.point(mouse.x, mouse.y)) // nothing to do, took over by pinchArea onCanceled: _initialEvent = undefined function doStuff(position) { if (mouseArea._initialEvent !== undefined && mouseArea.enabled) { console.log('Doing stuff with ', mouseArea._initialEvent.x, ':', mouseArea._initialEvent.y); } mouseArea._initialEvent = undefined; console.log('Doing stuff with ', position.x, ':', position.y); } }// end: MouseArea } } Simon
  • Chnage property in ListModel

    Solved
    2
    0 Votes
    2 Posts
    143 Views
    dheerendraD
    @Damian7546 said in Chnage property in ListModel: payListModel May be you can look ListModel set(..) or setProperty(..) method. This may help you.
  • Unable to assign [undefined] to QQuickItem*

    Unsolved
    8
    0 Votes
    8 Posts
    2k Views
    R
    Hi @J-Hilk , Can I know how we can get this warning resolved as we cannot create an instance of pageRegister due to pragma of singleton . May I know if there is any other way to achieve the same. Thanks in Advance.
  • QML TextArea : Wrapping placeholder text

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    Q
    its works fine independently but this way we are not actually using placeholder text, is there some way we can wrap the placeholder text explicitly
  • PlaceHolder Text not wrapping for TextArea

    Unsolved
    1
    0 Votes
    1 Posts
    112 Views
    No one has replied
  • QML List View Bottom To Top

    Unsolved
    1
    0 Votes
    1 Posts
    775 Views
    No one has replied
  • create my own editor in QML and QT-Jambi

    Unsolved
    1
    0 Votes
    1 Posts
    94 Views
    No one has replied
  • QML List View is not updating when the model is updated

    Unsolved
    4
    0 Votes
    4 Posts
    376 Views
    Y
    @piervalli It's assumed to clear one. As the reference code I used a tutorial for this app removes one Item. I found that rowCount() always return same value in qml. But it updates in c++. and i used qDebug() << m_Items.size() in this function. It also gives me same number. I am confused. what's going on. If you want to see full code it's : header file: https://github.com/yegender124001/avdan-os-dock/blob/master/appmodel.h definations: https://github.com/yegender124001/avdan-os-dock/blob/master/appmodel.cpp
  • How can i get bounds from object 3D model Quick3D?

    Unsolved
    1
    0 Votes
    1 Posts
    106 Views
    No one has replied
  • Receive value from MenuItem

    Unsolved qml menu menuitem variable
    2
    0 Votes
    2 Posts
    439 Views
    T
    Your code should be fine. I think that the console.log() command is just in the wrong place. If I understood correctly, there are two user interactions involved. The first one is the click on the mouse area, which opens the menu. The second one is a click on a particular menu item, which actually sets the test value. Let's say you are performing the first interaction for the first time. At this point, the variable hasn't been set as you haven't clicked on a menu item yet. That is why the output of the console.log() command will be undefined. Then, you click on a menu item, which sets the variable. However, you won't be able to see the change until the menu is closed and you perform another click on the mouse area to make the menu pop up again. I think you'll see that your code works if you move the console.log() command to a different place: id: mouseArea1 property var testValue; onClicked: { menu.popup(); } Menu { id: menu MenuItem { text: "Option1" onTriggered: { mouseArea1.testValue= "25"; console.log(mouseArea1.testValue); } } } I don't know how many menu items you have in your actual code. Doing it this way, you'd need to add the same line to the onTriggered() signal handlers on all MenuItem instances, which could be annoying and bloat your code unnecessarily. So I'd suggest doing this instead: id: mouseArea1 property var testValue; onClicked: { menu.popup(); } Menu { id: menu MenuItem { text: "Option1" onTriggered: { mouseArea1.testValue= "25"; } } onClosed: { console.log(mouseArea1.testValue); } } I am assuming that the menu is closed once you hit a menu item. The code above logs the variable once the menu emits a closed() signal. I haven't tried it myself, but it should work. :)
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • Qt Creator sets wrong QML2_IMPORT_PATH in environment.

    Unsolved
    1
    0 Votes
    1 Posts
    311 Views
    No one has replied
  • Collision with Qml 3D

    Unsolved
    4
    0 Votes
    4 Posts
    989 Views
    S
    have you solve the problem?I have the same question
  • how 3d collision detection works?

    Unsolved
    1
    0 Votes
    1 Posts
    206 Views
    No one has replied
  • How to get IOS like look and feel in QML Style.

    Unsolved qml qtquick ios combobox style
    1
    0 Votes
    1 Posts
    414 Views
    No one has replied
  • How to access C++ Model data directly from QML without any ListView/Repeater/etc ?

    Solved
    4
    0 Votes
    4 Posts
    841 Views
    R
    @dheerendra @GrecKo Thank you, I did not know that.
  • Custom component bindings

    Solved
    3
    0 Votes
    3 Posts
    325 Views
    J
    @dheerendra Your solution works perfectly. As an extra benefit, I learnt a lot by studying your code. Thank you so much! 🙏
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • RoundButton with GlowEffect

    Unsolved
    2
    0 Votes
    2 Posts
    276 Views
    johngodJ
    Dont know if it will work, but try to put that RoundButton inside a Rectangle with a radius equal to half is width and clip enabled