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,
// Setup dragging for examiner widget
// ======================================================================
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
examiner_widgets_[i]->setExternalDrag(true);
connect( examiner_widgets_[i], SIGNAL(startDragEvent( QMouseEvent*)),
this, SLOT(startDrag(QMouseEvent* )));
......
......@@ -126,7 +126,6 @@ QtBaseViewer::QtBaseViewer( QWidget* _parent,
sceneGraphDialog_(0),
options_(_options),
disableKeyHandling_(false),
externalDrag_(false),
snapshotName_("snap.png"),
snapshotCounter_(0),
snapshot_(0),
......@@ -1690,11 +1689,7 @@ void QtBaseViewer::glMousePressEvent(QMouseEvent* _event)
{
case ExamineMode:
if ((_event->modifiers() & Qt::ControlModifier)) // drag&drop
if ( externalDrag_ ) {
emit startDragEvent( _event );
} else {
startDrag();
}
else
viewMouseEvent(_event); // examine
break;
......
......@@ -886,17 +886,11 @@ private:
protected:
/// drag & drop for modelview copying
virtual void startDrag();
/// drag & drop for modelview copying
virtual void glDragEnterEvent(QDragEnterEvent* _event);
/// drag & drop for modelview copying
virtual void glDropEvent(QDropEvent* _event);
public:
/// Enable or disable external dragging controls
void setExternalDrag( bool _external ) { externalDrag_ = _external; };
signals:
/** Signal is emitted when Control modifier is pressed and mouse moded.
* It will only be emitted if in externalDragMode ( see setExternalDrag )
......@@ -913,12 +907,6 @@ private:
*/
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 @@
//== 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)
{
if ( externalDrag_ ) {
emit dragEnterEvent(_event);
} else {
if ( _event->mimeData()->hasFormat("text/plain") )
_event->acceptProposedAction();
}
}
void QtBaseViewer::glDropEvent(QDropEvent* _event)
{
if ( externalDrag_ ) {
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