PDA

View Full Version : to show Checkboxes in listview



Ketan Shah
20th May 2011, 11:15
hii,
this is my code....


QStringList fileTypes;
fileTypes << "_*.dll" ;
QDir dir("E:/qtpro/ext");
dir.setNameFilters(fileTypes);
QFileInfoList list = dir.entryInfoList();

//ui->textEdit->append("Bytes Filename");
for (int i = 0; i < list.size(); ++i)
{
QFileInfo fileInfo = list.at(i);

//QString s= fileInfo.size();
QString s1 = fileInfo.fileName();
//s.append(s1);
ui->textEdit->append(s1);*/

this displays the dll files in the directory in the textedit..

now i want to display all these dlls as checkboxes in the listview...
can any1 help me how to do this...

i had also wrote this code for adding checkboxes in listview...bt got error...


Q3ListView view(0);
view.setResizeMode( Q3ListView::LastColumn );
view.addColumn( "Filename" );
view.show();
QStringList files = dir.entryList();
for( QStringList::Iterator it = files.begin(); it != files.end(); ++it)
{
(void)new Q3CheckListItem ( &view, *it, Q3CheckListItem::CheckBox );
}


i got this error...:
:: error: collect2: ld returned 1 exit status


plz help..

high_flyer
20th May 2011, 14:12
You are using Qt3Support classes.
You need to add it to your pro file:
QT += qt3support

Ketan Shah
20th May 2011, 14:45
and is my code is correct..???
i had made changes in my .pro file...it worked...thanx..
it opened d application when i run it, but gave me segmentation fault...

Added after 4 minutes:

and is my code is correct..???
i had made changes in my .pro file...it worked...thanx..
it opened d application when i run it, but gave me segmentation fault...

high_flyer
23rd May 2011, 09:01
ut gave me segmentation fault...
run it in a debugger and see which line segfaults.