void BuildListView(QStandardItemModel listModel, ListModel model) { listModel.setRowCount(model.GetItems().Count); listModel.setColumnCount(6); ArrayList list = new ArrayList(); list.add("Extension"); list.add("Color"); list.add("Description"); list.add("> Bytes"); list.add("% Bytes"); list.add("Files"); listModel.setHorizontalHeaderLabels(list); int i = 0; foreach (var item in model.GetItems()) { com.trolltech.qt.core.QModelIndex index = listModel.index(i, 0); listModel.setData(i, 0, item.Extension); listModel.setData(i, 1, item.Color.ToString()); listModel.setData(i, 2, item.Description); listModel.setData(i, 3, ListModel.FormatSizeString(item.Bytes)); listModel.setData(i, 4, string.Format("{0:P1}", (item.PercentBytes))); listModel.setData(i, 5, item.FileCount.ToString()); i++; } }
static void BuildListStore(Gtk.ListStore listStore, ListModel model) { foreach (var item in model.GetItems()) { string[] values = new string[] { item.Extension, item.Color.ToString(), item.Description, ListModel.FormatSizeString(item.Bytes), string.Format("{0:P1}", (item.PercentBytes)), item.FileCount.ToString() }; listStore.AppendValues(values); } }