0
I am trying to recover data from a Qlistwidgetitem when I click on the list but am not getting it. I made a custom Widget to list the elements, but although I can not see in the event click recover my element.
Event click of the application
void Start::on_phonebookList_itemClicked(QListWidgetItem *item)
{
    // ContactListItem *cItem = (ContactListItem*)item;
    ContactListItem * cItem = (ContactListItem * )ui->contactPhonebookNumberList->itemWidget(item);
    this->contactSelected = cItem->getContact();
    ui->contactPhonebookName->setText( this->contactSelected->name.toLatin1().data());
    const QVector<PhonebookNumber *> list = this->contactSelected->getNumbers();
    for(int i=0;i!=list.size();i++){
        PhonebookNumber * pn =list[i];
        ui->contactPhonebookNumberList->addItem(pn->number.toLatin1().data());
    }
    ui->nav->setCurrentIndex(NavigationTabs::CONTACT);
}
Popular the list
void Start::on_Start_onReloadPhonebookListEvent(const PhonebookType & type)
{
    if(this->getCurrentPhonebookType() != type){
        return;
    }
    const QVector <PhonebookContact*> list = Phonebook::getInstance()->getPhoobook(type);
    this->ui->phonebookList->clear();
    for(int i = 0; i!= list.size();i++){
        QListWidgetItem *widgetItem = new QListWidgetItem();
        this->ui->phonebookList->addItem(widgetItem);
        ContactListItem * contactItem  = new ContactListItem();
        contactItem->setContact(list[i]);
        widgetItem->setSizeHint(QSize(contactItem->width(),contactItem->height()));
        this->ui->phonebookList->setItemWidget(widgetItem,contactItem);
    }
}