Q3 classes are not recommend to be used for new code, it's only to support old code
There are couple of ways to do this, one of the ways would be implement a class which is a sub-class of Q3CheckListItem and use that new class to add items on the view. Then implement Q3CheckListItem::stateChange() virtual method in the new class, and use the text() method to get the name an use it.
Example:
class myItem : public Q3CheckListItem
{
public:
//add required constructors
protected:
stateChange (bool b)
{
if(b == true)
{
if(state() == Q3CheckListItem::On)
{
item_name = text();
// Use item_name or whatever you want
}
}
}
};
...
for (int i = 0; i < files.size(); ++i)
{
fileInfo = files.at(i);
item
= new myItem
(listView,
QString(â€
%1â€
).
arg(fil eInfo.
fileName()),Q3CheckListItem
::CheckBox );
}
...
class myItem : public Q3CheckListItem
{
public:
//add required constructors
protected:
stateChange (bool b)
{
QString item_name;
if(b == true)
{
if(state() == Q3CheckListItem::On)
{
item_name = text();
// Use item_name or whatever you want
}
}
}
};
...
for (int i = 0; i < files.size(); ++i)
{
fileInfo = files.at(i);
item = new myItem(listView,QString(â€%1â€).arg(fil eInfo.fileName()),Q3CheckListItem::CheckBox );
}
...
To copy to clipboard, switch view to plain text mode
Bookmarks