hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mywindow.cpp
changeset 2 49c70dcc3f17
parent 1 e48454f237ca
child 3 c863538fcbb6
equal deleted inserted replaced
1:e48454f237ca 2:49c70dcc3f17
   125 			view->setRowCount( 3 );
   125 			view->setRowCount( 3 );
   126 		}else {
   126 		}else {
   127 			view->setColumnCount( 3 );
   127 			view->setColumnCount( 3 );
   128 			view->setRowCount( 5 );			
   128 			view->setRowCount( 5 );			
   129 		}
   129 		}
   130         view->setTextVisible(false);
   130 //        view->setTextVisible(false);
   131 		view->setUniformItemSizes( true );
   131 		view->setUniformItemSizes( true );
   132 		view->setItemRecycling( true );
   132 		view->setItemRecycling( true );
   133 		//this could be done to change mode, for images it doesn't make sence, becouse images thumbnails are created by default only for medium and fullsize
   133 		//this could be done to change mode, for images it doesn't make sence, becouse images thumbnails are created by default only for medium and fullsize
   134 //		AbstractDataProvider *data = mModel->DataProvider();
   134 //		AbstractDataProvider *data = mModel->DataProvider();
   135 //		MyDataProvider *prov = static_cast<MyDataProvider*>(data); //of course we have already poiter to that - mMyDataProvider, but it is example how to get it from model
   135 //		MyDataProvider *prov = static_cast<MyDataProvider*>(data); //of course we have already poiter to that - mMyDataProvider, but it is example how to get it from model
   165         mModel->setSortRole(Qt::DisplayRole);
   165         mModel->setSortRole(Qt::DisplayRole);
   166         mModel->setSortCaseSensitivity(Qt::CaseInsensitive);
   166         mModel->setSortCaseSensitivity(Qt::CaseInsensitive);
   167         mModel->sort(0);
   167         mModel->sort(0);
   168     } else if (command == 201) { //disable filter
   168     } else if (command == 201) { //disable filter
   169         QRegExp reg = QRegExp();
   169         QRegExp reg = QRegExp();
   170 //        mModel->setFilterRegExp(reg);
   170         mModel->setFilterRegExp(reg);
   171     } else if (command == 202) { //Filter ITEM* (Case Sensitive)
   171     } else if (command == 202) { //Filter ITEM* (Case Sensitive)
   172         QRegExp reg = QRegExp("ITEM*", Qt::CaseSensitive, QRegExp::Wildcard);
   172         QRegExp reg = QRegExp("ITEM*", Qt::CaseSensitive, QRegExp::Wildcard);
   173 //        mModel->setFilterCaseSensitivity(Qt::CaseSensitive);
   173         mModel->setFilterCaseSensitivity(Qt::CaseSensitive);
   174 //        mModel->setFilterRegExp(reg);        
   174         mModel->setFilterRegExp(reg);        
   175     } else if (command == 203) { //Filter ITEM1*(Case Insensitive)
   175     } else if (command == 203) { //Filter ITEM1*(Case Insensitive)
   176         QRegExp reg = QRegExp("ITEM1*", Qt::CaseInsensitive, QRegExp::Wildcard);
   176         QRegExp reg = QRegExp("ITEM1*", Qt::CaseInsensitive, QRegExp::Wildcard);
   177 //        mModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
   177         mModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
   178 //        mModel->setFilterRegExp(reg);
   178         mModel->setFilterRegExp(reg);
   179     } else if (command == 1000) { //reset
   179     } else if (command == 1000) { //reset
   180         mMyDataProvider->resetModel();
   180         mMyDataProvider->resetModel();
   181     } else if (command == 1001) { //reset
   181     } else if (command == 1001) { //reset
   182         bool current = !mModel->dynamicSortFilter();
   182         bool current = !mModel->dynamicSortFilter();
   183         mModel->setDynamicSortFilter(current);
   183         mModel->setDynamicSortFilter(current);
   188         }
   188         }
   189     } else if (command == 1002) {
   189     } else if (command == 1002) {
   190         mTestVal = 500;
   190         mTestVal = 500;
   191         timeout();
   191         timeout();
   192     } else if (command == 1003) {
   192     } else if (command == 1003) {
   193         mTestVal = 0;
   193         mTestVal = -1;
   194     }
   194     }
   195 }
   195 }
   196 
   196 
   197 void MyWindow::setIndex(int /*index*/)
   197 void MyWindow::setIndex(int /*index*/)
   198 {
   198 {
   203 {   
   203 {   
   204     HbAction action;
   204     HbAction action;
   205     action.setData ( QVariant(101 + mTestVal%4) );
   205     action.setData ( QVariant(101 + mTestVal%4) );
   206     processAction(&action);
   206     processAction(&action);
   207 
   207 
   208     if (mTestVal>0){
   208     
       
   209     if (mTestVal>=0){
   209         mTestVal--;
   210         mTestVal--;
   210         mTimer->start(1000);
   211         if (mTestVal==0){
       
   212             mTestVal = 500;
       
   213         }
       
   214         mTimer->start(2000);
   211     }
   215     }
   212 }
   216 }
   213 
   217 
   214 //eof
   218 //eof