Important: Please read the Qt Code of Conduct -

"Current" item in QListView on Windows has a grey highlight until it is clicked on.

  • Hello everybody,

    I have a QListView of items with the single item selected from the start via

    QListView::setCurrentIndex(const QModelIndex &)

    When user clicks on an item in the list, it becomes "current",
    because the signal QListView::clicked is connected to the slot that calls the method above.

    The problem:

    When the list is opened for the first time, the "current" item is highlighted with the pale grey bar:

    When user clicks on an item in the list for the first time, it becomes highlighted with the blue bar. From that moment on, whatever current item is, the highlight is blue:


    • The problem affects the look of the list only. The item is selected correctly regardless of the colour of the highlight.

    • The appearance of the list relies on system defaults.

    • The problem happens on Windows 8.1 only. The same program behaves as expected on Ubuntu 14.04 (i.e. the current item has blue system highlight from the start).

    • I tried to fix the problem by emitting QListView::activated(index) or QListView::clicked(index) signals. It did not help.

    • Using Qt 5.5.1 MSVC-2012 32 bit

    Thank you in advance for any suggestions!


  • Lifetime Qt Champion


    Can you check whether it does the same thing if you first call setFocus on your QListView ? Also is the window containing the QListView active ? Or is another program having the main focus ?

  • Hi SGaist,

    QListView::setFocus(Qt::MouseFocusReason) solved the problem! Thank you very much!!!


  • Lifetime Qt Champion

    You're welcome !

    Since you have it working, now please make the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

Log in to reply