Thursday, December 09, 2010

Latest Lessons on Widgets from Dialcentral

This is a bit of a catch-all post to go back over some previously covered items with some new things learned.

TreeViews


HTML Delegates
I previously couldn't find the way to do custom cell renderers.  In part the oddity is that they provide default ways to render that are meaningless when you provide Delegates.  I did some searching and found an example HTML Delegate.  It had some issues with dark themes so I had to fix several bugs in it.



Simple heirarchy
Next I wanted Dialcentral to have letter separators in the contact list.  I never messed with hierarchical views in GTK before so I can't really compare.  My first time branching out to applying this to Messages and History turned out bad because it seems to have the parent items' columns aligned with the child's columns.  The original History view had 3 columns with the left two scrunched together.  These didn't provide much space for the parent row's text.  When I switched to a condensed history view this became moot.

Condensed history view, allowing the parent text to fit.
When learning about hierarchical views I found out that the root expander decorator is given space by default even if there are no children and it isn't shown.  This saved some space in the UI and will clean up the look of my other applications.

Layouts

The only real comment I have for layouts regards QGridLayout which I've not used before this.  Early on I was looking at using my pie menus for the buttons which had some issues, so I setup the alignment.  This didn't help but when I switched to buttons I eventually found out that it caused the buttons to fit to their minimum size rather than expand.  I probably fixed the pie menu issue without realizing I had thwarted myself.

Combo Box

The only real trouble I ran into with QComboBox was when I wanted it editable.  I was going to use this to allow choosing an existing GV configured callback or a custom one.  On the desktop the only way I've gotten it to insert into the list the item I'm creating is when there is nothing else to capture the enter key press.  Otherwise what gets activated is the "Apply" button (or worst "Clear Account" button when I remove the "Apply" button).  I've not found my way around this issue yet.

Callback Combobox caused problems on desktop Qt