[Development] QTextFragment visibility option

Pierre Stirnweiss pstirnweiss at googlemail.com
Thu Jan 19 10:48:53 CET 2012


On Tue, Jan 17, 2012 at 3:48 PM, Simon Hausmann <simon.hausmann at nokia.com>wrote:

> Hi Pierre,
>
>
> I can see now how you'd be able to implement tracking with this, but I
> wonder
> how much more complex this makes your layout altogether, because hidden
> fragments are right now subject to the layout and they're always visible in
> content (i.e. the number of characters in the document).
>
> One idea Lars and I had when discussing this was to extend the fragment
> tree.
> The block tree uses this idea to calculate the block number by extending
> the
> size_array/size_left_array. A similar approach could be used to separate
> the
> visible from the invisible fragments and keep them in sync at the same
> time.
>
> The main issue with that approach is that it pessimises the common case in
> terms of memory usage and it is a compile time decision.
>

Well, I am not sure I have followed you completely on that one. I'll need
to check the code to see what you are referring to.


> > 2. second important use case for Calligra Words: substitution characters
> > for objects (anchors,...).
> >
> > Although these characters are not "displayed" within the text (because
> > their size is returned as 0 width), they are still laid out. This means
> > that on cursor movement, they are not traversed. This means the user need
> > to press several times the arrow key to go through what appears as a
> single
> > cursor position on screen.
>
> Can you elaborate a bit how fragment visibility helps with the
> implementation?
> Are those _supposed_ to be part of the content/undo-redo but you just want
> to
> toggle their visibility?
>

Well, visibility only (as in merely not drawing) is indeed not sufficient.
We also need to have cursor movement handling. The thing is that cursor
movement can be handled outside Qt, not layouting a fragment cannot.
Handling the cursor within Qt is of course way cleaner.
Anyway, as it seems we will be able to implement that without breaking BIC,
we have much more time than I initially feared. It means we indeed can do
it complete in Qt.


>
> > 3. further interesting use case (but which is not yet that stringent for
> > Calligra Words): hiding portions of text on demand
> >
> > This can be interesting for example in case of multiple user editing.
> Some
> > portions of text might be irrelevant/confidential (although for
> > confidentiality, this would be a very very weak solution) for some users
> > and not for others.
> > Another use case of that type is similar for example to IDE code
> folding. I
> > am not interested in seeing this part of the text (like in IDE an if
> > block), so I would like to hide it for now.
>
> This sounds tricky though, because there's currently no way to forcibly
> split
> a fragment. I guess you'd also need that?
>

Probably yes. However this use case is way remote.

>
> I think we can proceed with the fragment visibility, but it needs to be
> consistently implemented. I'll explain that in Gerrit.
>
> Yes, let's take the time to discuss clearly the several implications of
this. Once our release is out (which is drawing very near), I'll take more
time to give this further, deeper thought and discussions.

Pierre



> Simon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120119/b0c3e682/attachment.html>


More information about the Development mailing list