widget style cleanup

Andrew Coles andrew_coles at yahoo.co.uk
Tue Sep 14 13:24:56 BST 2004


On Tuesday 14 Sep 2004 12:15, Andrew Coles wrote:
> I'll look into it, and see if it seems at all feasible.

OK, the layout side of things should be relatively straight forward: CSS boxes 
can do the same layouts that QT layout widgets can; further, the equivalent 
layouts can be defined once in a stylesheet so the filesize of ported 
dialogues, and the server load, should be quite reasonable.

The first significant hitch I've come across is that I can't find any way of 
performing in-line calculations in the document to determine, for example, 
the height of a scrollbar for a QListBox.

Say you had a QListBox--visible height 160 pixels--containing 20 items, each 
20 pixels high.  That means there's 400 pixels of content to show in 160 
pixels of space - so a vertical scrollbar will be added.  Say the scrollbar 
arrow heads are 'x' pixels high each, then the slider on the scrollbar needs 
to be:

((160 / 400) * (160 - 2x)

i.e. the fraction of the total height shown multiplied by the height of the 
scroll bar

So the document would need to do this calculation on-the-fly: the height of 
the scroll arrows and, if the listbox items contain text, the items in the 
list vary - it's not always 20.  The 160 pixels bit would be fixed in the 
layout, so the final calculation is

((height of box / (20 * height of a list box item)) * (height of box - 2 * 
height of scroll arrows)

Unless someone knows of a way of doing this sort of calculation on the client 
side as the document is being rendered - perhaps (ECMA|Java)script - I can't 
think of a way of getting around the problem.  I'm no expert in web page 
design -- I've learnt about CSS layouts just to investigate how feasible my 
idea is -- so if anyone has a solution to this problem please let me know!

Thanks,

Andrew




More information about the kde-core-devel mailing list