Drag and Drop from 2 Listwidgets, but change text after dropping in 2nd Listwidget
-
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.
-
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.
-
@SGaist , Oh okay, thanks, this narrows down my search, but what code logic can i put in drop mime data method,
can you provide code segment. -
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.