[Interest] ListModels and ListViews question

VStevenP vstevenpavao at yahoo.com
Tue Nov 25 05:17:34 CET 2014


I've developed a QML List widget which internally contains a ListView and a ListModel and has some properties to configure the appearance of the ListView delegates, and which also allows the List to work as either a ComboBox or List.  The ListModel is dynamically populated with custom strings either during its Component.onCompleted method, or via a list of QStrings supplied internal to the widget by a C++ class I exposed to QML.

Question: Is there a syntax I can use which would allow me to connect a specialized external ListModel to the ListView inside my List widget?  In other words:

import CustomListModel 1.0   // exposed to QML from C++ by qmlRegisterType()


CustomListModel {
  id: customListModel
}

List {  // a custom QML widget
  id: list

  //is there a way to connect my List widget's internal ListView to use the CustomListModel

}

Basically, I wish to find a way to glue different custom models to the ListView in my reusable List widget, but I'm not sure if it's possible.  In this case, the List model I wish to attach is a Bonjour Browser which is supplying a dynamic list of available service names.  It would be really nice to be able to reuse my List widget with other specialized models without having to generate a new variation of the List widget.

- VStevenP



More information about the Interest mailing list