Basically, what I have is the following :
A QListWidget, with some items in it like this :
ListMail
is my QListWidget.
In this QListWidget, I ha
You must bind to the itemClicked signal. The signal will provide you with a QListWidgetItem*
which is the item that was clicked. You can then examine it and check if it is the first one:
MyClass::MyClass(QWidget* parent)
: QWidget(parent)
{
connect(ui->listMail, SIGNAL(itemClicked(QListWidgetItem*)),
this, SLOT(onListMailItemClicked(QListWidgetItem*)));
}
void MyClass::onListMailItemClicked(QListWidgetItem* item)
{
if (ui->listMail->item(0) == item) {
// This is the first item.
}
}
QListWidget has a signal QListWidget::itemPressed(QListWidgetItem *item)
that will tell you which item was clicked. You can connect this signal to your own slot. There are also other related signals. See the documentation.