baray98
29th November 2008, 22:18
I embed a widget(using QGraphicsProxyWidget) inside a QGraphicsItem and arranged my items to a scene and they are about 10 pixels apart, now My widgets has QContextMenu in it i noticed that when i show my context menu in a particular widget it is shown at the back of the nieghboring widget. I don't like it to be this way , since its a pop up menu it should be painted on top of everything in its way.
Can someone help me with my goal? maybe i miss something in embedding my widget
here a snippet of the constructor
RoundRectItem::RoundRectItem(const QRectF &rect, const QBrush &brush,GraphicsView *graphWidget, QWidget *embeddedWidget)
: QGraphicsRectItem(rect),m_embeddedWidget(embeddedW idget),
m_graph(graphWidget),
m_brush(brush),
m_opacity(50),
m_proxyWidget(0)
{
setFlag(ItemIsMovable);
setCacheMode(DeviceCoordinateCache);
setZValue(3);
if (embeddedWidget)
{
m_proxyWidget = new QGraphicsProxyWidget(this);
m_proxyWidget->setWidget(embeddedWidget);
m_proxyWidget->setZValue(zValue()+1);
setRect(embeddedWidget->rect());
}
}
baray98
Can someone help me with my goal? maybe i miss something in embedding my widget
here a snippet of the constructor
RoundRectItem::RoundRectItem(const QRectF &rect, const QBrush &brush,GraphicsView *graphWidget, QWidget *embeddedWidget)
: QGraphicsRectItem(rect),m_embeddedWidget(embeddedW idget),
m_graph(graphWidget),
m_brush(brush),
m_opacity(50),
m_proxyWidget(0)
{
setFlag(ItemIsMovable);
setCacheMode(DeviceCoordinateCache);
setZValue(3);
if (embeddedWidget)
{
m_proxyWidget = new QGraphicsProxyWidget(this);
m_proxyWidget->setWidget(embeddedWidget);
m_proxyWidget->setZValue(zValue()+1);
setRect(embeddedWidget->rect());
}
}
baray98