[SailfishDevel] Wanting to port my app, QML questions (TextArea)
mark at faultycode.com
Wed Sep 18 17:31:00 UTC 2013
Thanks for the advise, I'll be reading over those documents soon to see the possibilities.
But a quick question about your suggestion to use the ListView. I forgot to mention that I want users to be able select text over multiple lines. If I use a list view, would that be possible?
I'm assuming no since it seems that each item is it's own view.
Thanks for your fast reply, I appreciate it.
On 2013-09-18, at 2:04 PM, Knight Andrew <Andrew.Knight at digia.com> wrote:
> Hi Mark,
> Text does indeed support rich text and links, and by extension so do Silica text components. The text property is just get/set though - so if you add to it (i.e. += ), there may be some extra overhead of reprocessing the entire string. Alternatively, you can modify the document itself (the textDocument property) , but this is unsupported even though it works.
> This would be a good use case for a ListView and a Text item as a delegate. Each time a new text line comes in, you just add it to your model. The ListView only creates a new delegate for the new text, and view can be programmed to scroll away. Delegate instances that leave the view are deleted by default until they come back into view.
>  http://doc-snapshot.qt-project.org/qt5-stable/qtquick/qml-qtquick2-text.html
>  http://doc-snapshot.qt-project.org/qt5-stable/qtquick/qquicktextdocument.html
>  http://doc-snapshot.qt-project.org/qt5-stable/qtquick/qml-qtquick2-listview.html
> From: devel-bounces at lists.sailfishos.org [devel-bounces at lists.sailfishos.org] on behalf of mark at faultycode.com [mark at faultycode.com]
> Sent: Wednesday, September 18, 2013 2:53 PM
> To: devel at lists.sailfishos.org
> Subject: [SailfishDevel] Wanting to port my app, QML questions (TextArea)
> Hi Everyone,
> I have written an IRC client for iOS over the last years, and I am at a
> point where I'd like to choose a second platform to port my app over to.
> I've always been fond of Qt, but lost interest in it when Nokia
> switched to windows phone. Thus, I never got around to learning QML,
> which means I only have knowledge of making GUI's with QWidgets.
> However, now with Jolla, I'm really interested in starting my port.
> I have a few questions/concerns before I start porting.
> On the iOS side of things, I paste all my IRC messages into a textView
> (UITextView for the people here that know).
> As of iOS 7, I use the new TextKit features. That is, I can take a
> message coming from the TCP socket, make an Attributed String out of it
> (I guess a rich string in the Qt world), apply colours, underlining,
> bold etc to specific words depending on the colour codes in the message,
> then finally append it to the textView.
> I've been skimming through the QML components for Sailfish, and I've
> found the TextArea component. There is a string property to it, but I
> don't know if I can simply append data to it (specifically rich text
> data). It seems to me it's either read, or set.
> Is the TextArea string property modifiable, or is it immutable? If it's
> immutable, then perhaps I need to look at webkit.
> Secondly, the textView in iOS is capable of having URL links applied to
> ranges of text. Is that also possible with TextArea?
> skills are really lacking. Hence why I have been using rich text editing
> in my iOS app. However, if there is no other possibility, then I just
> might have to go the webkit route.
> Those are my biggest questions really. QML is completely new to me, but
> seems like a fun and powerful thing to learn.
> Thanks for you help,
> SailfishOS.org Devel mailing list
More information about the Devel