Unsolved Checkbox not working
-
When the checkbox is only checked, it does not selects the item. If it is checked as well as selected by mouse click, then it is selected. I want to remove the mouse selection. I just want to keep the selection through check box. Kindly help.
void Dialog::on_pushButton_clicked() { //Send Email QList<QTreeWidgetItem *> itemList; itemList = ui->treeWidget->selectedItems(); QString strTo = "mailto:"; foreach(QTreeWidgetItem *item, itemList) { // if(item->text(0)=="Organization") // continue; if(item->checkState(0)== Qt::Checked) strTo.append(item->text(0)+";"); } openUrl->openUrl(QUrl(strTo)); }
-
Hi! I'm not sure if I understood correctly what you want to do, so here are two suggestions: You can make all the items unselectable by setting the view's selection mode to
QAbstractItemView::NoSelection
. If you just want to deselect all items you can callQAbstractItemView::clearSelection()
.