On Monday, January 16, 2012 22:41:58 Mark wrote:
> > I would go for an API like this (just doing it out of my head..):
>  > AutoCompleter
>  > {
>  >   id: autoCompleter
>  > }
>  > 
>  > TextField
>  > {
>  >   completer: autoCompleter
>  > }
> 
> what is the advantage of declaring autocompleter independent and outside
> the textfield?
> 
>  (apart being close to impossible to make a c++ based component private :/)
> 
> 
> I honestly don't know. I don't even know how to get that working. Kinda
> discovering that as i go.. I never made such a complex QML part before.
> 
> The idea however is to have one component wich holds the data
> (AutoCompleter) and another component to use that data (TextField). How
> else would you do it? 

You write your autocompleter in C++, register it to the QML runtime using 
qmlRegisterType<>(), and then use it *inside* TextArea.qml and TextField.qml. 
So basically you compose it inside the components, instead of telling the user 
of your API to instantiate their own AutoCompleter. Would make it a bit harder 
to share it between elements, not sure how important that is, though...

See http://doc.qt.nokia.com/4.8-snapshot/qml-extending.html

Cheers,
-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to