Ah, i see from your deleted post what you say.
When QListWidget is clicked first time, it receives focus
When you then click a button, that button is now given focus.
Focus is not the same as selected for QListWidget.- one or more item can be selected.
You can try
qDebug() << ui->listWidget->currentItem()->text();