Example I'm trying to connect Items in ListWidgets to textEdit (Descr) so that when I click on item the correct descr. shows. I can move items with '->' button to 2nd List and correct descr. follows, I used Qmap as a container. Problem is once an item jump to 2nd List (or you click item in 2nd List) and then you click item in the 1st List, that item now has a Descr. of item from 2nd List i.e "2" has descr. "three". Happens when you switch selections between lists, if you switch selections within the same list - all is fine. Every clicked() signal reads the same (QMap record):
type void MainWindow::on_ToDoList_itemClicked(QListWidgetItem *item)
{
ui -> InProgressList -> clearSelection();
ui -> DoneList -> clearSelection();
QString buff = item -> text();
ui -> textEdit -> setText(record.value(buff));
}here
// I think the problem might be here:
void MainWindow::on_textEdit_textChanged()
{
QListWidgetItem* check;
if(ui -> ToDoList -> currentItem() != NULL) check = ui -> ToDoList -> currentItem();
if(ui -> InProgressList -> currentItem() != NULL) check = ui -> ToDoList -> currentItem();
if(ui -> DoneList -> currentItem() != NULL) check = ui -> ToDoList -> currentItem();
QString title = check -> text();
QString buff = ui -> textEdit -> toPlainText();
record[title] = buff;
}
clearSelection() because when you would switch selections between Lists then previous item would still be "semi-selected"(grey coloring) so I whought maybe it's that, but it's not. I think problem is probably with the ifs since its my idea to do it this way. I don't think it's '->' button issue since it happens without using it as well.