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

List:       koffice-devel
Subject:    Re: A little more mentoring needed
From:       Thomas Zander <zander () kde ! org>
Date:       2009-06-22 18:17:20
Message-ID: 200906222117.25926.zander () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Monday 22. June 2009 15.41.26 Elvis Stansvik wrote:
> > Storing pointers to the QTextFrame or even to the QTextTable is safe.
> > They are QObjects so you can just use a QPointer for them for even more
> > convenience.
>
> You mean I could use e.g. QMap<QPointer<QTextTable>, TableLayout> as a
> container that maps the QTextTables to their corresponding layout
> objects. Is that really safe?

Over dinner I thought of a method that may just work perfectly for this 
situation.

We have a QMap<QTextTable*, TableLayoutData*> m_tables;
and the moment we insert a table we do a;
 connect (table, SIGNAL(destroyed(QObject*)), this, 
SLOT(tableDeleted(QObject*)));

in the tableDeleted we can then properly get rid of the table in the map, 
and clean up the data too.

This should also solve your question of having one TableLayout per table; 
you can indeed have one data object per table but you should probably be ok 
with one TableLayout object per QTextDocument.

Cheers!
-- 
Thomas Zander

["signature.asc" (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


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

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