go-qml / qml

QML support for the Go language
Other
1.96k stars 187 forks source link

Text editor example #18

Closed raichu closed 10 years ago

raichu commented 10 years ago

A port of the text editor example would be a fantastic addition to examples: https://qt-project.org/doc/qt-5.1/qtquickcontrols/text.html

niemeyer commented 10 years ago

Indeed. I won't work on this for now, but will keep this open as inspiration for someone.

laurent22 commented 10 years ago

I've actually started implementing this example in order to try the library. So far I got the editor window to display with the text area and tool bar.

The part I'm stuck with now is that I need to create a QTextCharFormat object to set the text format. However, I couldn't find how to do that. Currently, is there a generic way to create an arbitrary Qt object and set its properties? If not, what would be the best approach to implement this? (I'm thinking I might need to add it to the C api but not sure how to do that yet).

niemeyer commented 10 years ago

@laurent22 If it's a pure Qt type that is useful in the Go QML package context, we can wrap it inside the qml package itself, as we've done in similar cases. With that said, not all Qt types will be necessary in a QML context. The specific case of the TextArea QML type is somewhat of a gray area, as they've wrapped part of a Qt type, but at the same time haven't finished exposing its C++ API. We may end up wrapping some of that C++ API, or perhaps the QML-specific types will evolve more of that functionality internally. Either direction is doable for us in Go QML land, but it might be wise to wait a bit longer before taking that step, since the Quick Controls are a relatively young concept. Of course, if somebody does need the functionality in practice, rather than just for an exercise, we can discuss this more seriously.

For the time being, I'm closing this issue, as porting an example isn't an actual bug we can easily discuss or get fixed. If you'd like to open more specific bugs to individual pieces that you're missing, that'd be welcome.

niemeyer commented 10 years ago

I've also filed a bug upstream related to the issue of TextArea being half-baked:

https://bugreports.qt-project.org/browse/QTBUG-36521