Remove redundant drag'n'drop interface

In the long time of parallel assembly development an own drag'n'drop interface has been added to master and assembly branch. After merge both have been available. This commit removes one and keeps the more extensive implementation
This commit is contained in:
Stefan Tröger
2016-08-27 12:25:15 +02:00
committed by wmayer
parent 0a539538de
commit cd53eb2280
7 changed files with 43 additions and 130 deletions

View File

@@ -73,68 +73,6 @@ std::vector<std::string> ViewProviderDocumentObjectGroup::getDisplayModes(void)
return std::vector<std::string>();
}
bool ViewProviderDocumentObjectGroup::allowDrop(const std::vector<const App::DocumentObject*> &objList,
Qt::KeyboardModifiers keys,
Qt::MouseButtons mouseBts,
const QPoint &pos)
Q_UNUSED(keys);
Q_UNUSED(mouseBts);
Q_UNUSED(pos);
for( std::vector<const App::DocumentObject*>::const_iterator it = objList.begin();it!=objList.end();++it)
if ((*it)->getTypeId().isDerivedFrom(App::DocumentObjectGroup::getClassTypeId())) {
if (static_cast<App::DocumentObjectGroup*>(getObject())->isChildOf(
static_cast<const App::DocumentObjectGroup*>(*it))) {
return false;
}
}
return true;*/
Base::Console().Message("allow drop called");
}
void ViewProviderDocumentObjectGroup::drop(const std::vector<const App::DocumentObject*> &objList,
Qt::KeyboardModifiers keys,
Qt::MouseButtons mouseBts,
const QPoint &pos)
{
Q_UNUSED(keys);
Q_UNUSED(mouseBts);
Q_UNUSED(pos);
// Open command
App::DocumentObjectGroup* grp = static_cast<App::DocumentObjectGroup*>(getObject());
App::Document* doc = grp->getDocument();
Gui::Document* gui = Gui::Application::Instance->getDocument(doc);
gui->openCommand("Move object");
for( std::vector<const App::DocumentObject*>::const_iterator it = objList.begin();it!=objList.end();++it) {
// get document object
const App::DocumentObject* obj = *it;
const App::DocumentObject* par = App::DocumentObjectGroup::getGroupOfObject(obj);
if (par) {
// allow an object to be in one group only
QString cmd;
cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").removeObject("
"App.getDocument(\"%1\").getObject(\"%3\"))")
.arg(QString::fromLatin1(doc->getName()))
.arg(QString::fromLatin1(par->getNameInDocument()))
.arg(QString::fromLatin1(obj->getNameInDocument()));
Gui::Command::runCommand(Gui::Command::App, cmd.toUtf8());
}
// build Python command for execution
QString cmd;
cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").addObject("
"App.getDocument(\"%1\").getObject(\"%3\"))")
.arg(QString::fromLatin1(doc->getName()))
.arg(QString::fromLatin1(grp->getNameInDocument()))
.arg(QString::fromLatin1(obj->getNameInDocument()));
Gui::Command::runCommand(Gui::Command::App, cmd.toUtf8());
}
gui->commitCommand();
}
bool ViewProviderDocumentObjectGroup::isShow(void) const
{
return Visibility.getValue();