Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

DnDcontainer in QStateMachine, Drag and Drop no longer works?

$
0
0
I have a DnDcontainer in Screen3 below. Drag and Drop into the DnDcontainer used to work fine, until I updated the project to use QStateMachine and QAbstractTransition, to add simple transitions between screens. After adding the transitions, everything works except Drag and Drop to the DnDcontainer, the DnDcontainer::dragEnterEvent and DnDcontainer::dropEvent methods are never executed, and when hovering over the DnDcontainer, I get a circle with a slash through it. What am I missing here? How do I pass the Drag and Drop signal to the DnDcontainer? Screen1 *_screen1 = new Screen1; Screen2 *_screen2 = new Screen2; Screen3 *_screen3 = new Screen3; QGraphicsProxyWidget *_screen2Proxy = new QGraphicsProxyWidget; _screen2Proxy->setWidget(_screen2); QGraphicsProxyWidget *_screen1Proxy = new QGraphicsProxyWidget; _screen1Proxy->setWidget(_screen1); QGraphicsProxyWidget *_screen3Proxy = new QGraphicsProxyWidget; _screen3Proxy->setWidget(_screen3);   Pixmap *_stepper = new Pixmap(QPixmap(":/Images/imgs/stepper.png")); Pixmap *_player = new Pixmap(QPixmap(":/Images/imgs/player.png")); Pixmap *_stext = new Pixmap(QPixmap(":/Images/imgs/stepper-text.png"));   QWidget *_tb = new QWidget; _tb->setStyleSheet("background-image: url(:/Images/imgs/menubar-full.png);background-repeat: repeat-x;"); _tb->setMinimumHeight(42); _tb->setMinimumWidth(w); QGraphicsProxyWidget *_tbProxy = new QGraphicsProxyWidget; _tbProxy->setWidget(_tb);   scene->addItem(_tbProxy); scene->addItem(_screen3Proxy); scene->addItem(_screen1Proxy); scene->addItem(_screen2Proxy); scene->addItem(_stepper); scene->addItem(_player); scene->addItem(_stext);   QStateMachine machine; QState *state1 = new QState(&machine); QState *state2 = new QState(&machine); QState *state3 = new QState(&machine); machine.setInitialState(state1);   // state1 state1->assignProperty(_tbProxy, "geometry", QRect(0, 0, w, 42)); state1->assignProperty(_screen3Proxy, "geometry", QRect(0, 0, w, h)); state1->assignProperty(_screen1Proxy, "geometry", QRect(w, 50, w, h)); state1->assignProperty(_screen2Proxy, "geometry", QRect(2*w, 50, w, h)); state1->assignProperty(_stepper, "pos", QPointF(w-154, 0)); state1->assignProperty(_player, "pos", QPointF(w-154, 0)); state1->assignProperty(_stext, "pos", QPointF(w-154, 0)); // view state1->assignProperty(_tbProxy, "opacity", qreal(1)); state1->assignProperty(_screen3Proxy, "opacity", qreal(1)); state1->assignProperty(_screen1Proxy, "opacity", qreal(0)); state1->assignProperty(_screen2Proxy, "opacity", qreal(0)); state1->assignProperty(_stepper, "opacity", qreal(1)); state1->assignProperty(_player, "opacity", qreal(1)); state1->assignProperty(_stext, "opacity", qreal(1));

Viewing all articles
Browse latest Browse all 18427

Trending Articles