In the attachement simple app that shows the problem. Try to drag and
drop to the view...
Hi.
I'm doing dropping to the QGraphicsView some data.
I successfully receive dragEnterEvent( QDragEnterEvent * event ) and
here accept action with event->acceptProposedAction().
But I don't receive dropEvent on dropping and cursor shows that my
view doesn't accept drop.
Why? What am I doing wrong?
--
Best Regards,
Igor Mironchik.
--
Best Regards,
Igor Mironchik.
#include <QApplication>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QMainWindow>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMessageBox>
class View
: public QGraphicsView
{
public:
View( QWidget * parent )
: QGraphicsView( parent )
{
setAcceptDrops( true );
}
protected:
void dragEnterEvent( QDragEnterEvent * event )
{
event->acceptProposedAction();
}
void dropEvent( QDropEvent * event )
{
QMessageBox::information( this, tr( "Drop" ),
tr( "You just dropped something to me." ) );
event->acceptProposedAction();
}
};
class Window
: public QMainWindow
{
public:
Window()
{
View * view = new View( this );
view->setAlignment( Qt::AlignLeft | Qt::AlignTop );
QGraphicsScene * scene = new QGraphicsScene( this );
view->setScene( scene );
setCentralWidget( view );
}
};
int main( int argc, char ** argv )
{
QApplication app( argc, argv );
Window w;
w.show();
return app.exec();
}
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest