Commit ef080ca4 authored by Jan Möbius's avatar Jan Möbius
Browse files

Remove drag handling from internal viewer ( handled by coreWidget )

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4476 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 28c3ec7b
...@@ -192,7 +192,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -192,7 +192,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
// Setup dragging for examiner widget // Setup dragging for examiner widget
// ====================================================================== // ======================================================================
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) { for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
examiner_widgets_[i]->setExternalDrag(true);
connect( examiner_widgets_[i], SIGNAL(startDragEvent( QMouseEvent*)), connect( examiner_widgets_[i], SIGNAL(startDragEvent( QMouseEvent*)),
this, SLOT(startDrag(QMouseEvent* ))); this, SLOT(startDrag(QMouseEvent* )));
......
...@@ -126,7 +126,6 @@ QtBaseViewer::QtBaseViewer( QWidget* _parent, ...@@ -126,7 +126,6 @@ QtBaseViewer::QtBaseViewer( QWidget* _parent,
sceneGraphDialog_(0), sceneGraphDialog_(0),
options_(_options), options_(_options),
disableKeyHandling_(false), disableKeyHandling_(false),
externalDrag_(false),
snapshotName_("snap.png"), snapshotName_("snap.png"),
snapshotCounter_(0), snapshotCounter_(0),
snapshot_(0), snapshot_(0),
...@@ -1690,11 +1689,7 @@ void QtBaseViewer::glMousePressEvent(QMouseEvent* _event) ...@@ -1690,11 +1689,7 @@ void QtBaseViewer::glMousePressEvent(QMouseEvent* _event)
{ {
case ExamineMode: case ExamineMode:
if ((_event->modifiers() & Qt::ControlModifier)) // drag&drop if ((_event->modifiers() & Qt::ControlModifier)) // drag&drop
if ( externalDrag_ ) { emit startDragEvent( _event );
emit startDragEvent( _event );
} else {
startDrag();
}
else else
viewMouseEvent(_event); // examine viewMouseEvent(_event); // examine
break; break;
......
...@@ -886,17 +886,11 @@ private: ...@@ -886,17 +886,11 @@ private:
protected: protected:
/// drag & drop for modelview copying
virtual void startDrag();
/// drag & drop for modelview copying /// drag & drop for modelview copying
virtual void glDragEnterEvent(QDragEnterEvent* _event); virtual void glDragEnterEvent(QDragEnterEvent* _event);
/// drag & drop for modelview copying /// drag & drop for modelview copying
virtual void glDropEvent(QDropEvent* _event); virtual void glDropEvent(QDropEvent* _event);
public:
/// Enable or disable external dragging controls
void setExternalDrag( bool _external ) { externalDrag_ = _external; };
signals: signals:
/** Signal is emitted when Control modifier is pressed and mouse moded. /** Signal is emitted when Control modifier is pressed and mouse moded.
* It will only be emitted if in externalDragMode ( see setExternalDrag ) * It will only be emitted if in externalDragMode ( see setExternalDrag )
...@@ -913,12 +907,6 @@ private: ...@@ -913,12 +907,6 @@ private:
*/ */
void dropEvent( QDropEvent* _event ); void dropEvent( QDropEvent* _event );
private:
/** flag defining, if dragging will be handled internal by the viewer or passed via signals to
* the application
*/
bool externalDrag_;
/** @} */ /** @} */
......
...@@ -47,43 +47,15 @@ ...@@ -47,43 +47,15 @@
//== IMPLEMENTATION ========================================================== //== IMPLEMENTATION ==========================================================
void QtBaseViewer::startDrag()
{
QString view;
encodeView(view);
QDrag * drag = new QDrag( this );
QMimeData * mime_data = new QMimeData;
mime_data->setText( view );
drag->setMimeData( mime_data );
drag->start();
}
void QtBaseViewer::glDragEnterEvent(QDragEnterEvent* _event) void QtBaseViewer::glDragEnterEvent(QDragEnterEvent* _event)
{ {
if ( externalDrag_ ) { emit dragEnterEvent(_event);
emit dragEnterEvent(_event);
} else {
if ( _event->mimeData()->hasFormat("text/plain") )
_event->acceptProposedAction();
}
} }
void QtBaseViewer::glDropEvent(QDropEvent* _event) void QtBaseViewer::glDropEvent(QDropEvent* _event)
{ {
if ( externalDrag_ ) { emit dropEvent( _event );
emit dropEvent( _event );
} else {
if ( _event->source() != this )
{
QString view( _event->mimeData()->text() );
decodeView(view);
_event->acceptProposedAction();
}
}
} }
//============================================================================= //=============================================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment