PDA

View Full Version : QContextMenu in an embeded widget



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

jpn
2nd December 2008, 19:20
Here's a small test case the reproduce the problem:


#include <QtGui>

int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QGraphicsScene scene;
scene.addWidget(new QTextEdit);
scene.addWidget(new QTextEdit)->moveBy(50, 50);
QGraphicsView view(&scene);
view.show();
return app.exec();
}

I'd report it as a bug to the Task Tracker (http://www.trolltech.com/developer/task-tracker).