c++ - Using a QListView or similar effectively in Qt4 -


I am slowly using the QT4 GUI framework to use. In a project I am working, I should be able to add / edit / delete the team objects in a list. Coming from C # .NET perspective, I

  list & lt; Team & gt; Team = new list & lt; Team & gt; (); Teams LISTBox.DataSource teams; TeamsListBox.DisplayMember = "name";  

Then use the button on the form to add / delete / edit.

But, as I can tell, there is no easy way to do this in Qt. I have seen the documentation for QListView, QListWidget, QStandardItemModel etc. But how can I get the equivalent Qt code for C #?

My purpose Team in some sort of list box, then team s on runtime Be able to add / delete / edit

How would you do this?

You should see a customized team ITEM model class for your teams from QAbstractItemModel Or should make. The customized class will be managed by how items are displayed in a widget like QListView.

QString with a simple example for the item:

  QStringList list; List & lt; & Lt; "Item 1" & lt; & Lt; "Item 2" & lt; & Lt; "Item 3" & lt; & Lt; "Item 4" & lt; & Lt; "Item5"; UI-> List View- & gt; Setmodel (new QStringListModel (list));  

Then adding / updating / updating the team should be easier than you have been attempted.

Hope that helps.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -