A widget or a class? What is "it"? The model or the "widget"?
Very strange.... what is msgList? How is it related to what model->data() returns?[/quote]then when comparing passes I need to select a row on which the item is...
So I wrote this code:
Qt Code:
if(model->rowCount()){ for(int row=0; row<model->msgList.size();++row){ const QVcaCanMsg &msg = model->msgList.at(row); if((msg.id()==id) && (msg.flags()==flags)){ msgLogView->selectRow(row); } } }To copy to clipboard, switch view to plain text mode
You mean you want to select all items that have some data piece set to some value?But the problem is that it selects one after another so only the last item that passes the comparing stays selected in a view...
Is there any way how to make it so ALL items that pass the comparing will get selected ?
Thanks
I'd surely use QAbstractItemModel::match() for that... I don't know how your model is organized, but it seems you should be using data() instead of that msgList object which probably shouldn't be accessible outside the model.






Reply With Quote
Bookmarks