[Solved] Qt5 QAbstractItemModel::setSupportedDragActions() deprecated
-
It seems that QAbstractItemModel::setSupportedDragActions() deprecated in Qt 5, Previously we could use
@model->setSupportedDragActions(Qt::MoveAction);@
What to use in Qt 5 ?
-
--any updates--
-
did you check the porting guide?
http://qt-project.org/doc/qt-5.0/qtdoc/portingguide.html -
QAbstractItemModel::supportedDragActions() is now virtual (as supportedDropActions() is).
-
[quote author="Thomas Zander" date="1359463661"]did you check the porting guide?
http://qt-project.org/doc/qt-5.0/qtdoc/portingguide.html[/quote]Yes but there is no information for setSupportedDragAction() however i checked "Compatibility Members for QAbstractItemModel":http://qt-project.org/doc/qt-5.0/qtcore/qabstractitemmodel-compat.html
[quote author="Lukas Geyer" date="1359464000"]QAbstractItemModel::supportedDragActions() is now virtual (as supportedDropActions() is).[/quote]
I checked this "commit":https://gitorious.org/trojita/trojita/commit/7f88a8630d8ca7a48aa902b121167ccce3cfba1e and also "porting to the final release of Qt 5":http://comments.gmane.org/gmane.comp.lib.qt.user/5264 but got a bit confused what should be used. For my custom model i override supportedDropActions()
@Qt::DropActions DragDropListModel::supportedDropActions() const
{
return Qt::CopyAction | Qt::MoveAction;
}@but then i also used
@model->setSupportedDragActions(Qt::MoveAction); @So is it required or should i drop that statement ?
-
[quote author="Sam" date="1359464719"]... for my custom model i override supportedDropActions() ...[/quote]Just override supportedDragActions() in the same way instead of calling setSupportedDragActions().
-
[quote author="Lukas Geyer" date="1359469546"]Just override supportedDragActions() in the same way instead of calling setSupportedDragActions().[/quote]
Thanks a lot, I understood now.
Regards
Soumitra. -
You're welcome! ;-)