In the last blog, I gave a laconic overview of my tasks for GSoC 2022.
The main features were those of adding datasets and improving the UI/UX components of the activity. The functioning of the Delegate Model in QML is one of the major takeaways from this week’s work.
Apart from this, I also found it a tad bit challenging to maintain the smooth flow of communication with my mentors as the implementation of each feature begins with a tiny change in a day, which might not seem considerable to us as rookie contributors, but for the mentors it is significant. As one of my mentors, Johnny, rightly said, ” You never make a small change. You make a change, and we need to know what it is. “
The Three Zones
Zone 1: Plain Text Zone
Zone 2: The Selector Zone
Zone 3: Answer Zone
The plain text zone gives the view of the whole exercise, the selector zone contains the flickable items, and we can now select a question by simply tapping on it. The selected question is highlighted too, and the answer zone displays the selected row in an enlarged manner.
Accessing index in List Model
Accessing Index in List Model
A brute force way to get the index would have been to manually maintain it for every item.
However, if we exploit the concept of delegation modelling, our task can become much more convenient. Qt offers a built-in separation into model, view, and delegate (MVC) components and one auxiliary, a delegate. A delegate is the QML object that a user wants to display. Data is fed into the delegate through named data roles, which the delegate may refer to. Thus, by importing QtQML models, we defined an index property which is attached to each instance of delegate and thus can be used to attain the index for each item.
- MouseArea for selecting the texts by tapping on it
- Functioning of QtQml Models
- maintaining the genericity of the code so that it can be reused.
- to keep the structure of the zones intact with different numbers of digits.
- the concept of delegate and why we cannot get an index from a list model while trying to extract the index of items. This kept me baffled for quite some time.
What is around the corner?
We need to make the code more generic. Some interesting soundtracks can make the experience more worthwhile. Apart from this, the accurate presentation of data sets is also in queue. So, wait for it!