I have ran into an issue. My GUI contains two treeWidgets with some push buttons. The first treeWidget lists out the files and the corresponding path of the folder in two separate columns. The second treeWidget adds and deletes single item using push buttons. Now if the user wants the facility of Ctrl+RightClick then how to incorporate the same.
Also I'm facing the duplication of items in the second treeWidget i.e. once the item is selected in first treeWidget, I can't restrict the addition of that item several times in second treeWidget. The code blocks are:
void Dialog::pushAdd_clicked()
{
QTreeWidgetItem *item_1 = ui->treeWidget->currentItem();
ui->treeWidget_2->addTopLevelItem(new QTreeWidgetItem(*item_1));
}
void Dialog::pushDelete_clicked()
{
QTreeWidgetItem *item_2 = ui->treeWidget_2->currentItem();
delete item_2;
}
Kindly note that I'm using treeWidget, not treeView.