Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QListView item with border 0 still visible
Forum Update on Monday, May 27th 2025

QListView item with border 0 still visible

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 1 Posters 4.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArtemK
    wrote on 3 Sept 2010, 10:39 last edited by
    #1

    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]

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on 4 Sept 2010, 03:16 last edited by
      #2

      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.

      1 Reply Last reply
      0

      1/2

      3 Sept 2010, 10:39

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved