In QtQuick MouseArea has a property 'pressed' indicating if the user is currently holding the mouse button pressed on this mouse area. QmlWeb is currently missing it.
There is more stuff in MouseArea that I was missing, btw. I think I was missing the onPositionChanged signal (or alternatively the properties mouseX and mouseY together with their changed signals)
I added this one as a single task, because I think it's an ideal entry point to start hacking on QmlWeb.
Hey! I am new to open source projects. This would be my first one. How do i start contributing to it? As in how do I see the code having the bug? How do I edit that? Thanks!
Hi, thanks a lot for your interest in contributing to QmlWeb! :) Actually this task turned out to be quite hard. The property 'pressed' is implemented and there's no bug about that, the only problem left, is that in QtQuick there's a signal with the same name, which makes it hard to implement both properly. Instead I'd propose implementing the property 'pressedButton'. That one is still missing. It would be an ideal entry point :) First of all, you will have to get the source code of QmlWeb using git, from https://projects.kde.org/projects/playground/www/qmlweb/repository (If you don't know git, yet: http://git-scm.com/book/en/Getting-Started-About-Version-Control and http://git-scm.com/book/en/Getting-Started-Installing-Git) The next step is to open the source file src/qtcore.js and search for the function called QMLImage. You will understand how to add a new property and how to set it, when needed (when the mouse was pressed/released on the HTML/DOM element). You should moreover adjust the test/testpad/mousearea.qml and add some simple feedback to test if the property works as intended (it's totally up to you, how to test it, the tests we have are currently quite bad, so no high standards there ;)) You can call the test, by accessing test/testpad/viewer.html#mousearea.qml with your webbrowser. When you finished the edit, you need to create a diff-file. You can do so using `git diff > mypatch.diff`. The next step is to go to reviewboard.kde.org, login and file a review request to QmlWeb, providing your diff-file. I will then have a look at it , comment on it and for the beginning I'll commit them, as soon as they're good enough to be included in QmlWeb. When you have done a few contributions, you may apply for a KDE developer account, enabling you to commit your patches yourself, directly. :) (http://techbase.kde.org/Contribute/Get_a_Contributor_Account)
I saw the qtcore.js file and pressed is already implemented in QMLMouseArea. QMLImage has no such property and not even a clicked signal but I don't think that is needed if we can implement MouseArea in it. Did I understand it wrong? Please clear my doubt.
Oh, yes, that was a typo, actually. I meant QMLMouseArea. It does have 'pressed' already, but doesn't have 'pressedButtons' yet. I changed the summary of this bug, to refer to 'pressedButtons'.
What does 'pressedButtons' supposed to do? What is the difference between pressed and pressedButton?
pressed is a boolean just stating true or false, whether a mouse button is currently pressed down or not, while pressedButtons is a flags value, containing exactly which buttons are pressed. For details, see: http://qt-project.org/doc/qt-4.8/qml-mousearea.html#pressedButtons-prop
Created attachment 85969 [details] Proposed Patch I have added the property 'pressedButtons' in QMLMouseArea. On mousedown, I'm assigning the mouse button pressed and on mouse up it is being assigned the value -1. Please tell if I did it right.
Thanks a lot for the patch. :) :) :) The principle is right. :) But you have to not use mouse.button but mouse.buttons, in order to get all buttons that are pressed. mouse.buttons does not exist currently, so that would be the ideal point to change that. :D The principle would be similar to what is done for mouse.button, only using e.buttons and instead of checking if e.buttons is == some value, you'd have to check if it contains some value using the & operator. Moreover the individual values need to be combined using the | operator. The second thing is, that you should not reset the value to -1 on release, but to 0. Ideally you should use http://reviewboard.kde.org to post your patch for review :) (You can use the same login credentials like here)
This project is unfortunately no longer maintained. If a new maintainer wants to step up and take care, the project is archived here: https://invent.kde.org/unmaintained/qmlweb You can just clone it in your private namespace on invent.kde.org and if you have started to work on it and fixed/implemented something get it reviewed and the project unarchived. Sorry for the inconveniences.