2013-06-04 6 views

답변

0

모델을 찾아보고 정규식 만 적용하려는 경우 QAbstractItemModel :: rowCount() 및 QAbstractItemModel :: columnCount()와 두 개의 루프를 사용하여 QAbstractItemModel :: item()을 사용하여 모델의 각 항목을 가져올 수 있습니다.) :

for (int col = 0; col < model.columnCount(); ++col) 
{ 
    for(int row = 0; row < model.rowCount(); ++row) 
    { 
    item = model.item(row, col); 
    doSomething(item->text());   
    } 
} 

당신이 당신의 정규 표현식과 일치하는 항목 만 표시 할 모델을 필터링하려면, 당신은 QSortFilterModel를 사용해야합니다.

작은 구문 오타 및 들여 쓰기를 편집합니다.