2011-04-01 7 views

답변

0

당신은 사용할 수 있습니다

QString fileName = "hello.txt"; 
QString filePath = "/home/user/hello.txt"; 

//Adding to listWidget 
QListWidgetItem *item =new QListWidgetItem(); 

item->setText(fileName); 
item->setData(1,filePath);//here role is set as 1 

listWidget->addItem(item); 
//For taking back that filePath 

QString filePath = listWidget->currentItem()->data(1); //note::: role equals 1 
:

ListWidgetItem::setData(int role,Qvariant data); 

이처럼 filePath;

를 저장하기 위해