Adding CheckBoxes In ListView in Qt-4
hii,this is my code…I want to display all the .dll files present in a directory as checkable items in a list….how can i do this….can any 1 help me for this…
i had already done this using Q3CheckListItem….but now i want to use any new method that exist in Qt4…and dont want to use the Qt3 Support…
QStringList fileTypes;
QDir dir;
QFileInfo fileInfo;
QStringList files;
Q3CheckListItem *item;
listView->setResizeMode( Q3ListView::LastColumn );
listView->addColumn( “Extension†);
//view.show();
//ui->listView->header()->hide();
fileTypes << “_*.dll†;
dir.setPath(“E:/qtpro/extâ€);
dir.setNameFilters(fileTypes);
files = dir.entryList();
for (int i = 0; i < files.size(); ++i)
{
fileInfo = files.at(i);
item = new Q3CheckListItem(listView,QString(â€%1â€) .arg(fileInfo.fileName()),Q3CheckListItem::CheckBo x );
}
Re: Adding CheckBoxes In ListView in Qt-4
Again, please use the [CODE] tags.
You may want to read documentation for QListWidgetItem and QListWidget.
Re: Adding CheckBoxes In ListView in Qt-4
Have a look at this post, you may need to change QPushButton to QCheckBox
http://www.qtcentre.org/threads/4146...ht=#post190790
Re: Adding CheckBoxes In ListView in Qt-4
Hi Ketan,
I am wanting to add a check box in column 0 in a ListView and I need to use Qt3.
Is the code snippet above for Qt3?
I am a complete newbie with Qt (any version) and would be so grateful for any information you can give me.
Many thanks,
Gary
Re: Adding CheckBoxes In ListView in Qt-4
It is almost for Qt3.
In Qt3 the class was calles QCheckListItem (without the "3", this was added to mark it as a compatibility class in Qt4)
Cheers,
_