Results 1 to 2 of 2

Thread: QContextMenu in an embeded widget

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QContextMenu in an embeded widget

    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
    Qt Code:
    1. RoundRectItem::RoundRectItem(const QRectF &rect, const QBrush &brush,GraphicsView *graphWidget, QWidget *embeddedWidget)
    2. : QGraphicsRectItem(rect),m_embeddedWidget(embeddedWidget),
    3. m_graph(graphWidget),
    4. m_brush(brush),
    5. m_opacity(50),
    6. m_proxyWidget(0)
    7. {
    8. setFlag(ItemIsMovable);
    9. setCacheMode(DeviceCoordinateCache);
    10. setZValue(3);
    11.  
    12. if (embeddedWidget)
    13. {
    14. m_proxyWidget = new QGraphicsProxyWidget(this);
    15. m_proxyWidget->setWidget(embeddedWidget);
    16. m_proxyWidget->setZValue(zValue()+1);
    17. setRect(embeddedWidget->rect());
    18. }
    19. }
    To copy to clipboard, switch view to plain text mode 

    baray98

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QContextMenu in an embeded widget

    Here's a small test case the reproduce the problem:
    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char* argv[])
    4. {
    5. QApplication app(argc, argv);
    6. scene.addWidget(new QTextEdit);
    7. scene.addWidget(new QTextEdit)->moveBy(50, 50);
    8. QGraphicsView view(&scene);
    9. view.show();
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 
    I'd report it as a bug to the Task Tracker.
    J-P Nurmi

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Widget Focus
    By navi1084 in forum Qt Programming
    Replies: 6
    Last Post: 29th September 2008, 10:22
  3. Playbutton functionality
    By uchennaanyanwu in forum Qt Programming
    Replies: 5
    Last Post: 31st July 2008, 22:29
  4. How to Open & Close a Widget ?!!
    By Fatla in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2008, 20:39
  5. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.