Drag & Drop and Context Menu problem QGraphicsScene
-
Sorry for my bad explanation.
Draging & Droping to QGraphicsScene works.
Context menu event on item inside scene does not work.
-
What happens if you do
@void SwitchItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *e)
{
contextMenu->move(e->screenPos());
contextMenu->show();
}@instead? Maybe there's an issue with calling an event loop within an event loop here. (Can't be too sure).
-
Nothing happens. Code does not even enter contextMenuEvent
-
Did you set the "QWidget::contextMenuPolicy":http://doc.trolltech.com/latest/qwidget.html#contextMenuPolicy-prop correctly?
-
Why should I set that?
-
It is not related with that. Its default option is Qt::DefaultContextMenu
-
could you please send me the whole project,every class and header file,including the main method.I have to do something similar ,just the drag and drop action,but i'm having difficulties with it and your complete code would be a great help for me..
I am supposed to do some college project,but i am seriously stuck,i've tried everything,searching online,doing it myself,but there's always some tiny error which messes everything up.Your code would definitely help me a lot..
my email is
narutouzumakis@live.comThank you in advance
Nikolas
-
or can anyone at least show me how the main function would look like,how everything should be called and initialized,please..
thanks