Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void diaOpenFileByListView::BindLV(){
- int curRow=-1;
- if(model!=0 && ui->lvwFile->currentIndex().row()>0){
- curRow= ui->lvwFile->currentIndex().row();
- }
- init_styleditemdelegate_cell listdelegate;
- model = new QStandardItemModel(this);
- ui->lvwFile->setModel(model);
- listdelegate = new init_styleditemdelegate_cell();
- ui->lvwFile->setItemDelegate(listdelegate);
- QDir dir=QDir::rootPath();
- QString myPath;
- myPath=gData->strFileFolder;
- dir.cd(myPath);
- ui->lblPath->setText(dir.absolutePath());
- dir.setNameFilters(QStringList()<<".qqq");
- QStringList fileList = dir.entryList();
- QStandardItem *item ;//= new QStandardItem();
- for (int i=0; i<fileList.count(); i++)
- {
- item = new QStandardItem();
- QString tmpFilePaht=dir.absolutePath()+"/"+fileList[i];
- QIcon icon=GetListIcon(tmpFilePaht);
- item->setData(icon,init_styleditemdelegate_cell::IconRole);
- item->setData(tmpFilePaht,init_styleditemdelegate_cell::headerTextRole);
- item->setData(fileList[i],init_styleditemdelegate_cell::subHeaderTextrole);
- item->setEditable(false);
- model->appendRow(item);
- }
- if(model->rowCount()>0){
- if(curRow>-1){
- ui->lvwFile->setCurrentIndex(model->indexFromItem(model->item(curRow,0)));
- }else{
- ui->lvwFile->setCurrentIndex(model->indexFromItem(model->item(0,0)));
- }
- }
- ShowIni();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement