A tale of specificity
I try to be perfect. And I don't feel right till I have finished something completely. So this following tale relates to the relation of specificity and perfection.
The current project I am working on has a list of lineEdits that I have put into a scrollarea.
This image shows what I was out to achieve.
First task was to get the scrollarea right. There I encountered first hurdle. See, the thing is the scrolled widget has a fixed size but here the size changes depending on the no of lineEdits added to the scroll Area. At first I settled on a fixed size and put in a spacer. But it wasn't perfect. There were some edge cases where that failed.
So after a lot of thinking I settled on a minimum size, and set size constraint to SetMinimumSize. Later when I added one widget I would increase minimum size and this proved to be a good solution.
Next step was to increase scrollbar width for use on touch screen. I hunted some CSS on net that let me increase the scrollbar width and style it to be usable on a touch screen.
The one mistake I did was, I applied the style to scroll area. And this above screen was the result. After going through the code and much more thinking, I understood that I have to be specific. I needed to apply the style only to scrollbar. That meant I have to hunt for the scrollbar object. Some more internetz provided me with verticalScrollBar() function. So I applied the style to it and voila!!!
I achieved my perfect scrollarea implementation!!!
Comments
Post a Comment