QListView item with border 0 still visible



  • Hi,

    I'm reposting question from Qt Centre ("http://www.qtcentre.org/threads/32488-QListView-item-with-border-0-still-visible":http://www.qtcentre.org/threads/32488-QListView-item-with-border-0-still-visible) because I have same problem, but my English is not so good.

    "So what am I trying to do?
    I have QListView that loads string list and shows it on the screen. Following is extract from the code:

    Qt Code: Switch view

    @
    QStringList list;
    list << "AAA" << "CCC" << "BBB";
    ui->listView->setModel( new QStringListModel(list) );
    @

    To copy to clipboard, switch view to plain text mode

    I'm using stylesheets to modify its appearance. In my case I just want color of text to change when item is selected. Following is stylesheet that I am using:

    @
    QListView::item
    {
    color: black;
    background-color: transparent;
    border: 0px;
    }
    QListView::item:selected
    {
    color: red;
    background-color: transparent;
    border: 0px;
    }
    @

    It works perfect in Qt Simulator (Windows).Behavior is as expected: color changes from black to red, both background colors are transparent, and there is no border.

    Now, the problem appears when I test it on Symbian Device (I'm testing on N97 mini). While color changes from black to red and background color remains transparent, border for some reason still appears. It is of white (whitish) color and it seems like 1 pixel wide.
    If I do add border (1px solid red), border appears around it. What do I need to do to remove this "white" border around QListView item?"

    In addition to it: It looks like border is around only text of item. Icon is rendered outside of border. I've tried to play with QListView::text in Qt Style Sheet, but it looks like any changes in QListView::text have no any effects. Can someone help me with it?

    Thank you

    [edit: fixed code format and links / $chetankjain]



  • Hi,
    yes can reproduce the problem. also I noticed that when the program is launched on the simulator, there is a white border on the first list item, which goes away when you change the selection.

    If you set the selectionmode to multiselection, the same behavior is observed on the simulator. Looks like a bug, you should log this.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.