0
votes

In my program, QListWidget be used in more than three place. Only one place, QListWidget does not emit the signal itemEntered(QListWidgetItem*).

My code:

MyListWidget::MyListWidget(QWidget* parent):QListWidget(parent)
{
    this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    this->setMouseTracking(true); 
    connect(this, SIGNAL(itemEntered(QListWidgetItem*)),        
            this, SLOT(slotOnItemEntered(QListWidgetItem*)));
}
MyListWidget::slotOnItemEntered(QListWidgetItem* item)
{
    // do something
}

When I debug, and move mouse glide the item, the program cannot go in the slotOnItemEntered(...) function. I want to konw, what condition can cause this phenomenon.

1
And at this one place, QListWidget emit signals itemPressed(...),itemClicked(...)...storm_zy

1 Answers

0
votes

This problem even don't know the reason. I use answer way to solve the problem.

QWidget has signals: enterEvent(...); // when mouse move in leaveEvent(...); // when mouse move out

I overwrite these two function, to solve the problem.