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

List:       koffice-devel
Subject:    Re: Clarification: Relationship between KoDocument and QTextDocument
From:       Ganesh Paramasivam <ganesh () crystalfab ! com>
Date:       2010-01-12 5:53:22
Message-ID: 9ecf537e1001112152r1f34e240qc214b32cdf656f3f () mail ! gmail ! com
[Download RAW message or body]

Just ignore my replies... :-) .. I'm indeed talking about
KoTextDocument and not KoDocument...

- Ganesh


On Tue, Jan 12, 2010 at 11:15 AM, Ben Martin
<monkeyiq@users.sourceforge.net> wrote:
> On Tue, 2010-01-12 at 11:07 +0530, Ganesh Paramasivam wrote:
>> Whenever you need a KoTextDocument you can just create it.
>>
>> QTextDocument *doc = getDocFromSomewhere();
>> KoTextEditor *editor = KoTextDocument(doc).textEditior();
>>
>> - Ganesh
>
> This is perhaps a slightly unfortunate naming, I am after a KoDocument*
> not a Ko_Text_Document object. As KoTextDocument lives in libs/kotext it
> can not really return a KoDocument which lives in libs/main.
>
> From quick grepping it doesn't seem that the non "Text", KoDocument
> object is set as a resource on QTextDocument too?
>
>>
>>
>> On Tue, Jan 12, 2010 at 10:58 AM, Ben Martin
>> <monkeyiq@users.sourceforge.net> wrote:
>> > On Tue, 2010-01-12 at 10:44 +0530, Ganesh Paramasivam wrote:
>> >> Hi,
>> >>
>> >> KoTextDocument class just acts as an access API to QTextDocument's resources.
>> >>
>> >> So you can do KoTextDocument(document).textEditor() to edit the document.
>> >>
>> >> Is this what you wanted to know ???
>> >
>> > The main thing was how or if you can get a KoDocument* from a
>> > QTextDocument*
>> >
>> >>
>> >> - Ganesh
>> >>
>> >> On Tue, Jan 12, 2010 at 7:53 AM, Ben Martin
>> >> <monkeyiq@users.sourceforge.net> wrote:
>> >> > Hi,
>> >> >  Sorry for another newbie post :| Though as the
>> >> > setResource()/resoruce() methods tend to obscure up the relations
>> >> > between classes, it would be wonderful to clarify things a little.
>> >> >
>> >> >  It seems there is a one to many relationship between K?Document
>> >> > and QTextDocument. The QTextDocuments are available through the
>> >> > FrameSets of the KWDocument. For example:
>> >> > KWDocument::mainFrameSet()->document();
>> >> >
>> >> >  The QTextDocument seems also to be possibly available through the
>> >> > KoCanvasResourceProvider, which itself can be obtained from the
>> >> > KoCanvasBase::resourceProvider() method.
>> >> >
>> >> >  For example, KoRulerController in tabChanged() uses:
>> >> > KoCanvasResourceProvider::resource(KoText::CurrentTextDocument)
>> >> > to obtain and check !isNull for the QTextDocument.
>> >> >
>> >> >  So, thinking out loud, and please shout out if this is incorrect or
>> >> > not the best way to get at things...
>> >> >
>> >> >  It seems that given a KoCanvasBase* you can alter the selection
>> >> > through the resourceProvider()->setResource(KoText::CurrentTextPosition,
>> >> > n) methods,
>> >> > and obtain the QTextDocument through the resource() interface. With a
>> >> > QTextDocument, the KoTextDocument gives access to a KoTextEditor
>> >> > allowing editing.
>> >> >
>> >> > The only missing link here is, in code that links to libs/main, being
>> >> > able to work out the KoDocument which owns a QTextDocument if possible.
>> >> > Otherwise, is the KoDocument obtainable starting from a KoCanvasBase*
>> >> > object?
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > koffice-devel mailing list
>> >> > koffice-devel@kde.org
>> >> > https://mail.kde.org/mailman/listinfo/koffice-devel
>> >> >
>> >> >
>> >> _______________________________________________
>> >> koffice-devel mailing list
>> >> koffice-devel@kde.org
>> >> https://mail.kde.org/mailman/listinfo/koffice-devel
>> >
>> > _______________________________________________
>> > koffice-devel mailing list
>> > koffice-devel@kde.org
>> > https://mail.kde.org/mailman/listinfo/koffice-devel
>> >
>> >
>> _______________________________________________
>> koffice-devel mailing list
>> koffice-devel@kde.org
>> https://mail.kde.org/mailman/listinfo/koffice-devel
>
> _______________________________________________
> koffice-devel mailing list
> koffice-devel@kde.org
> https://mail.kde.org/mailman/listinfo/koffice-devel
>
>
_______________________________________________
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