snoofkin
snoofkin

Reputation: 8895

QListView item background color

I'm trying to change the background color of the item which currently has the mouse hover.

What I've done so far is: I subclassed QListView and in the ctor:

connect(this,SIGNAL(entered(QModelIndex)),this,SLOT(enteredSlot(QModelIndex)));

The job basically needs to be done in the slot enteredSlot(QModelIndex) but I have no idea how.

Upvotes: 2

Views: 2109

Answers (1)

Arnold Spence
Arnold Spence

Reputation: 22272

You can achieve what you are trying to do a bit easier by setting a style sheet for your QListView. If you haven't worked with style sheets before you may want to back track in the documentation a bit but most common activities related to customizing the appearance of widgets can be done using them. Do not confuse them with QStyles which is a different styling mechanism.

Upvotes: 3

Related Questions