Morning,

>Option 3. Get rid of QDeclarativeTextEdit, and try to embed a
>QTextEdit through a QGraphicsProxyWidget. It usually doesn't work that
>well. Not recommended.

This is the option 3 i use for KhtEditor (available in community obs
in my home project), and it s works well. Once you unativate text
selection drag and drop, else the text will be dragged when qtextedit
is used in a flicable item.

Regards,

2011/7/16 Cornelius Hald <[email protected]>:
> Gregory, thanks for the detailed explanation!
>
> I think I have to go with option 2 and include the private headers.
> Composition is not enough, because I need access to non-public members
> of TextEdit.
>
> Also I've tried option 3 already. Basically it works, but the
> integration with QML is not that great.
>
> Basically I'm trying to do text editing like the 'Notes' application on
> Harmattan. As far as I can tell they are still using MTextEdit from MTF
> which already is deprecated.
>
> Thanks!
> Conny
>
>
> On Fri, 2011-07-15 at 12:55 -0700, Gregory Schlomoff wrote:
>> Depending on what you're trying to achieve you could either:
>>
>> Option 1 - Create a QDeclarativeItem that takes a TextEdit as a
>> property, and interact with it from your cpp code with getProperty /
>> setProperty:
>>
>> MyTextEdit {
>>   textEdit: TextEdit {}
>> }
>>
>> In your cpp code:
>>
>> class MyTextEdit : public QDeclarativeItem
>> {
>>   Q_PROPERTY(QDeclarativeItem* textEdit ... )
>> }
>>
>> Then you can use get / set property to interact with the text edit.
>> Basically, you'd be using composition instead of inheritance, which
>> generally is a a Good Thing, but sometime doesn't allow you to do what
>> you want.
>>
>> Option 2. Include the private header nonetheless. If you're linking to
>> Qt statically, or if you are distributing the library alongside with
>> your executable (this is the norm on Windows and Mac), then you
>> probably don't mind that much linking to a private header. You'll just
>> have to accept the fact that your code may not compile with newer
>> versions of Qt, and that you'll have to fix that by hand.
>>
>> Option 3. Get rid of QDeclarativeTextEdit, and try to embed a
>> QTextEdit through a QGraphicsProxyWidget. It usually doesn't work that
>> well. Not recommended.
>>
>>
>>
>> On Fri, Jul 15, 2011 at 12:26 PM, Cornelius Hald <[email protected]> wrote:
>> > Hi,
>> >
>> > I'd like to extend the TextEdit item in QML. The C++ code is in
>> > qdeclarativetextedit.cpp but the problem is that I can't find any public
>> > headers - only private ones.
>> >
>> > Originally I thought I'll create a sub-class, but it would also be ok to
>> > do it differently. Does anyone have an idea?
>> >
>> > Thanks!
>> > Conny
>> >
>> >
>> >
>> > _______________________________________________
>> > Qt-qml mailing list
>> > [email protected]
>> > http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>> >
>>
>>
>>
>
>
> _______________________________________________
> Qt-qml mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>



-- 
Benoît HERVIER, Khertan Software - http://khertan.net/
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to