Quote Originally Posted by gyre View Post
I need a widget that would go throug the whole model and do some comparing with items in it...
A widget or a class? What is "it"? The model or the "widget"?

then when comparing passes I need to select a row on which the item is...
So I wrote this code:

Qt Code:
  1. if(model->rowCount()){
  2. for(int row=0; row<model->msgList.size();++row){
  3. const QVcaCanMsg &msg = model->msgList.at(row);
  4. if((msg.id()==id) && (msg.flags()==flags)){
  5. msgLogView->selectRow(row);
  6. }
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 
Very strange.... what is msgList? How is it related to what model->data() returns?[/quote]

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
You mean you want to select all items that have some data piece set to some value?

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.