Drag and Drop from 2 Listwidgets, but change text after dropping in 2nd Listwidget
Unsolved
General and Desktop
-
The 'Country' QListwidget is going to be populated with country names items and if the user drags that an item and drops it in capital QListWidget, it should show me the name of its capital , i.e that item text should change in capital QListWidget.
for example - an item named "Russia" in country listwidget , after dragging and dropping , the item should be renamed to "Moscow".
so far to enable drag and drop, i have just written this code,
ui->country_listwidget->setDragEnabled(true); ui->capital_listwidget->setAcceptDrops(true);
is this possible in QT?
-
Hi,
There might be several ways. One of which is to subclass and re-implement the dropMimeData method to replace the country by its capital.
-
Good then please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found.