File indexing completed on 2024-06-09 09:27:47

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #include "mechanicsview.h"
0012 #include "mechanicsdocument.h"
0013 #include "viewiface.h"
0014 
0015 #include <QDragEnterEvent>
0016 #include <QMimeData>
0017 
0018 MechanicsView::MechanicsView(MechanicsDocument *mechanicsDocument, ViewContainer *viewContainer, uint viewAreaId)
0019     : ItemView(mechanicsDocument, viewContainer, viewAreaId)
0020 {
0021     setXMLFile("ktechlabmechanicsui.rc", true);
0022     m_pViewIface = new MechanicsViewIface(this);
0023 }
0024 
0025 MechanicsView::~MechanicsView()
0026 {
0027     delete m_pViewIface;
0028 }
0029 
0030 void MechanicsView::dragEnterEvent(QDragEnterEvent *e)
0031 {
0032     ItemView::dragEnterEvent(e);
0033     if (e->isAccepted())
0034         return;
0035 
0036     // e->setAccepted( e->provides("ktechlab/mechanical") ); // 2019.04.14
0037     e->setAccepted(e->mimeData()->hasFormat("ktechlab/mechanical"));
0038 }
0039 
0040 #include "moc_mechanicsview.cpp"