Yayati.Ekbote
14th April 2010, 08:55
Hi guys,
How can i disable sorting of QListView class if i want the items to be placed in the ListView as they are.???
For example-
QDir dir("/root");
dir.setSorting(QDir::DirsFirst);
const QFileInfoList *dirList=dir.entryInfoList();
QFileInfoListIterator it(dirList);
QFileInfo *fi;
while(fi=it.current())
{
QListVIewItem *dirItem=new QListViewItem(ListView);
dirItem->setText(0,fi->fileName());
ListView->insertItem(dirItem);
++it;
}
In this case the items which i want to show are file/folder items which i already sort in QDir class setSorting option. Now i don't want ListView to resort the items according to ascending or descending order..
QListView class gives sorting option as QListView::setSorting(int,bool ascending=True);
if i set int(column)=-1 the sorting is disabled but the items are always viewed in reverse order. where as i want my items to be viewed as Directories first and FIles later. Plz guide!!!
How can i disable sorting of QListView class if i want the items to be placed in the ListView as they are.???
For example-
QDir dir("/root");
dir.setSorting(QDir::DirsFirst);
const QFileInfoList *dirList=dir.entryInfoList();
QFileInfoListIterator it(dirList);
QFileInfo *fi;
while(fi=it.current())
{
QListVIewItem *dirItem=new QListViewItem(ListView);
dirItem->setText(0,fi->fileName());
ListView->insertItem(dirItem);
++it;
}
In this case the items which i want to show are file/folder items which i already sort in QDir class setSorting option. Now i don't want ListView to resort the items according to ascending or descending order..
QListView class gives sorting option as QListView::setSorting(int,bool ascending=True);
if i set int(column)=-1 the sorting is disabled but the items are always viewed in reverse order. where as i want my items to be viewed as Directories first and FIles later. Plz guide!!!