public override QVariant Data(QModelIndex index, int role) { if (!index.IsValid()) { return(new QVariant()); } if (role != (int)Qt.ItemDataRole.DisplayRole) { return(new QVariant()); } TreeItem item = (TreeItem)index.InternalPointer(); return(item.Data(index.Column())); }
public override QVariant Data(QModelIndex index, int role) { string start = "Data of " + this.SerializeModelIndex(index) + " requested with role " + role; if (!index.IsValid()) { m_Log.Debug(start + " (answer: empty)."); return(new QVariant()); } if (role != (int)ItemDataRole.DisplayRole && role != (int)ItemDataRole.DecorationRole) { m_Log.Debug(start + " (answer: empty)."); return(new QVariant()); } if (index.Column() == 0) { if (role == (int)ItemDataRole.DisplayRole) { m_Log.Debug(start + " (answer: \"" + (index.InternalPointer() as SolutionItem).Text + "\")."); return((index.InternalPointer() as SolutionItem).Text); } else if (role == (int)ItemDataRole.DecorationRole) { string key = (index.InternalPointer() as SolutionItem).ImageKey; System.Drawing.Image image = this.m_ExplorerTool.m_LinuxImageList[key]; if (image == null) { m_Log.Error("No association icon found for image key '" + key + "'."); } else { m_Log.Debug(start + " (answer: <qicon>)."); return(LinuxImageList.ConvertToQIcon(image)); } } } m_Log.Debug(start + " (answer: empty)."); return(new QVariant()); }
public override int RowCount(QModelIndex parent) { string start = "Row count of " + this.SerializeModelIndex(parent) + " requested"; SolutionItem parentItem; if (parent.Column() > 0) { m_Log.Debug(start + " (answer: 0)."); return(0); } if (!parent.IsValid()) { parentItem = this.m_RootItem; } else { parentItem = parent.InternalPointer() as SolutionItem; } m_Log.Debug(start + " (answer: " + parentItem.Count + ")."); return(parentItem.Count); }