HIG; dialogs and layouts.

Thomas Zander zander at kde.org
Tue Apr 3 11:27:05 BST 2007


Last week Ellen posted an update on the way they HCI people wanted to make 
clear how we should do layout of dialogs; see
http://www.kdedevelopers.org/node/2745

I've found that the proposed alignment is pretty darn hard to do in Qt 
Designer.  Doing right align is one thing; but aligning the items in multiple 
groupboxes is a lot harder to do properly.
So, I had an idea;  do this programmatically using a visitor which traverses 
all the widgets.

I added a class in KOffice libs to do just that. It takes a 'normal' dialog as 
we have been creating them in KDE3 for ages and adds alignments / minimum 
sizes to get the wanted results. Note that it is even capable of aligning the 
columns across tabs. ;)

Now; here is my question to k-c-d.
I need the proper coordinates of the (layouted) widgets to do the job, to 
determine what should line up and what not.  Prior to showing the dialog 
widgets don't have a coordinate. Some are at 0,0
In fact; even on the showEvent of the dialog widgets that are in a nested 
layout have coordinates 0,0

I ended up with a singleshot in the KPageDialog inheriting class which is 
called from the viewEvent().
This has 2 nasty side effects;
1) I need to add some 10 lines to each dialog to do this 'trick'.
2) The layout jumps due to being layouted twice. Hardly noticeable, but still.

We could move this to KDialog to avoid the first problem, but I see no 
solution for the second problem.

Thoughts, ideas, flames, praise?

See;
http://members.home.nl/zander/images/layoutvisitor-indent-spacing.png
and after;
http://members.home.nl/zander/images/layoutvisitor-indent-spacing-after.png

Another one;
http://members.home.nl/zander/images/layoutvisitor-pageLayout.png
and after;
http://members.home.nl/zander/images/layoutvisitor-pageLayout-after.png

The class;
http://websvn.kde.org/trunk/koffice/libs/kofficeui/KoLayoutVisitor.h?view=log
-- 
Thomas Zander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070403/5c82208f/attachment.sig>


More information about the kde-core-devel mailing list