My structure is like that,
QStringList list;
list << "Hello" << "world" << "Blah" << "Blah ;
QStringListModel *model = new QStringListModel;
model->setStringList(list);
QListView *view = new QListView(this);
view->setModel(model);
Now I want to make the list non editable on my GUI.
Add
view->setEditTriggers(QAbstractItemView::NoEditTriggers);
Derive your model from QStringListModel
and override flags()
to clear ItemIsEditable
flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With