PDA

View Full Version : how to remove the small dot when selecting ListWidget



sehnkim
25th April 2016, 21:48
hello all,

I am working with icons with listWidget, and here is my code.
Would you let me know how I can remove the small dot which the yellow arrow is pointing at?
(Please take a look at the image attached)
When I selected an item, the dot appeared right below the item I selected.
Thanks a lot.




ui->listWidget->setFlow(QListWidget::LeftToRight);
ui->listWidget->setViewMode(QListWidget::IconMode);
ui->listWidget->setIconSize(QSize(126,126));
ui->listWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff) ;
ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);

this->setStyleSheet("QMainWindow {background: black;}");

ui->listWidget->setStyleSheet(
"QListWidget {"
"border-style: solid;"
"border-width:1px;"
"border-color:black;"
"background-color: black;"
"}"
"QListWidget::item {"
"border: 0px solid black;"
"}");

for(int cnt = 0; cnt < 5; ++cnt)
{
QListWidgetItem* item = new QListWidgetItem;
QIcon icon(":/images/HMD.png");
item->setIcon(icon);
item->setFlags(item->flags() ^ Qt::ItemIsSelectable);
ui->listWidget->insertItem(cnt, item);
}

// http://stackoverflow.com/questions/6337589/qlistwidget-adjust-size-to-content
ui->listWidget->setFixedSize(ui->listWidget->sizeHintForColumn(0) * ui->listWidget->count() + 3 * ui->listWidget->frameWidth(),
ui->listWidget->sizeHintForRow(0) + 2 * ui->listWidget->frameWidth());

ChrisW67
25th April 2016, 21:57
It is not coming from anything obvious in your code. Does it appear if you place no items in the list widget? Does the dot move when you click on items? Does it appear in other applications or in a fixed position on the screen?

sehnkim
26th April 2016, 17:01
> Does it appear if you place no items in the list widget? => No.
> Does the dot move when you click on items? ==> If I click on other items, it moves to the item I just clicked. But even though I click on the same item again and again, it doesn't move.
> Does it appear in other applications or in a fixed position on the screen? ==> I tried with listWidget with another application, and had the same issue.

Here is the source code I am testing with.
https://www.dropbox.com/sh/g3yedv1iirwel6c/AAAjY0hUUbbZTOFsiRVzpiB7a?dl=0

Thanks.