69 static const char VIEW_MAGIC[] =
"ACG::QtWidgets::QGLViewerWidget encoded view";
75 QObject* senderPointer = sender();
78 if ( senderPointer != 0 ) {
79 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
88 if ( examinerId == -1 ) {
89 emit
log(
LOGERR , tr(
"startDrag in Core called by non examiner, stopping here"));
96 QPoint position = _event->pos();
103 unsigned int node_idx, target_idx;
112 objectId =
object->
id();
115 if ( objectId != -1 ) {
116 emit
log(
LOGERR , tr(
"dragEvent Picked Object"));
125 QDrag * drag =
new QDrag (
this );
126 QMimeData * mime_data =
new QMimeData;
128 mime_data->setText ( view );
129 drag->setMimeData ( mime_data );
136 if ( _event->mimeData()->hasFormat (
"text/plain" ) ) {
137 QString view ( _event->mimeData()->text() );
140 if ( view.left ( sizeof ( VIEW_MAGIC ) - 1 ) == QString ( VIEW_MAGIC ) ) {
141 _event->acceptProposedAction();
149 QObject* senderPointer = sender();
152 if ( senderPointer != 0 ) {
153 for (
unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
161 if ( examinerId == -1 ) {
162 emit
log(
LOGERR , tr(
"startDrag in Core called by non examiner, stopping here"));
168 if ( _event->mimeData()->hasUrls() ) {
169 QList<QUrl> urls = _event->mimeData()->urls();
170 for (
int j = 0 ; j < urls.size() ; ++j ) {
171 emit
log(
LOGWARN , tr(
"Dropped URL: %1").arg(urls[j].toLocalFile()));
178 if ( _event->mimeData()->hasFormat (
"text/plain" ) ) {
180 QString view ( _event->mimeData()->text() );
183 if ( view.left ( sizeof ( VIEW_MAGIC ) - 1 ) == QString ( VIEW_MAGIC ) ) {
185 _event->acceptProposedAction();
191 if ( view.left ( 7 ) == QString(
"file://") ) {
192 _event->acceptProposedAction();
198 emit
log(
LOGERR , tr(
"Unknown drop event! Unable to handle the dropped data! Received data: %1").arg(view));
201 emit
log(
LOGERR , tr(
"Unknown drop event!"));
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
void dropEvent(QDropEvent *_event)
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
void dragEnterEvent(QDragEnterEvent *_event)
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
void dragOpenFile(QString _filename)
std::vector< glViewer * > examiner_widgets_
Examiner Widget.
void log(Logtype _type, QString _message)
Logg with OUT,WARN or ERR as type.
pick any of the prior targets (should be implemented for all nodes)
void startDrag(QMouseEvent *_event)