Skip to content

Sok’22 Week 12: Final Week

Wednesday, 13 April 2022 | Samarth Raj

In my previous blog, I mentioned finalizing the activity by making the code clean, so it is ready to be merged.

Update on tasks mentioned in my previous blog

How to check if a device has mouse support?

There are a few ways for an application/browser to check mouse support in javascript, but they are not completely reliable as they fail when the device is touchscreen and has mouse support.

One way could be to use DeviceType.Mouse this enum represents the type of device that generated a QTouchEvent. But the enum does not change depending on the operating system. Another possible way could be QInputDevice, but this method is available in Qt 6.0, and our application is at Qt 5. I have created a phabricator task for the same. So when we upgrade to Qt6, we can apply this, and the visibility of the activities can be changed based on the input devices.

Phabricator task 

Some useful links for this:

Challenges Faced

  • When we click on the animal card, it moves towards its house. At first, implementing this idea was very challenging as the animal house is under a separate parent and the animal card is under a different parent. So the scope of the animal card to move is limited (within its parent). Selecting the correct coordinate was very important. One way is to assign the constant value, but this is not ideal as changing the house position will send the animal card to its previous position. So using ParentChange, I made them lie under the same parent, and now the animal card can identify its target, and this method will work even if the house position is changed.
  • The random placing of the animal cards inside the animal card container by avoiding overlap. For this, I created a third type of card which is invisible. The invisible card will help us create a random gap between two visible animal cards. We insert all the cards in an array, shuffle them, and then display the shuffled array containing animal cards as it is. In this way, we can solve the overlapping problem, and they are random as well.
  • Size of the animal cards. Initially, I used them with respect to their parents, but this is not the optimal way to do it. My mentors advised a better way to find the size of the cards. We have a function defined in core.js as fititem which takes the container’s height, width, and count of objects we want inside the container and provides us with the object’s length. By using this, I was able to make the size of animal cards more dynamic and adaptive to different screen sizes.

Experience as a Season of KDE contributor

I’ve always seen memes about how a bug makes us really anxious, and finding a solution makes us double happy at the next second. During the Season of KDE, I experienced this for the first time. I learned so many things by making mistakes, and now I am thankful for those mistakes because I got to know so many things by trying to fix one thing.  

It makes me proud that now I can call myself a successful contributor to open source. I am grateful to my mentors (Emmanuel and Harsh, Johnny and Timothee) for teaching me about Qt/Qml and for solving all my doubts, no matter how silly they were.

What next?

My interest has increased in open source contributions, and I wish to contribute more to KDE and other open source organizations in the future.

Thank you for taking the time to read this. 🙂