[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: CSSStyleSelector?
From:       Lars Knoll <knoll () kde ! org>
Date:       2001-09-26 17:31:51
[Download RAW message or body]

On Wednesday 26 September 2001 19:28, Martijn Klingens wrote:
> On Wednesday 26 September 2001 16:37, Lars Knoll wrote:
> > The construtor of the CSSStyleSelector takes a document, and then
> > traverses the list of style sheets from the document doc->stlyeSheets()
> > calling append for each of them. You'll have to do your work in this
> > append() call.
>
> Thanks!!!! Before reading this I was completely and utterly stuck. After
> reading this it took me about an hour to properly traverse the tree and to
> test and debug my code that built the tree...
>
> Next step is actually storing the list of media types and doing something
> with them.
>
> Any idea how to emulate
>
> QString mediaTypeString = "print, screen";
> QStringList mediaTypes = QStringList::split( ',',
>      mediaTypeString.stripWhiteSpace() );
>
> using DOM code? Besides the fact that the above code might not be robust
> enough, though given the checks before and after the part where the media
> list is extracted I don't expect serious problems.
>
> From what I understood now I have to walk through the curP pointer until I
> encounter a ',', then skip all whitespace and so forth until I am at endP.
> And store the data in a QValueList/QList. Right?

You can just use QString and QStringList for parsing if that's easier for 
you. There's a DOMString construtor taking a QString, so you can easily 
convert after parsing.

These parts are not performance critical , so I don't see any problems in 
doing it with 2 conversions more.

Lars

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic