Results 1 to 4 of 4

Thread: overlapping QGraphicsItem problem!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2006
    Posts
    34
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default overlapping QGraphicsItem problem!!

    Hi all,

    I am facing a problem when two QGraphicsItem movable items overlap on each other,
    the overlapping surface of items is determined by the last QGraphicsView item added
    to the QGraphicsScene. Say for example,
    MainWindow:: MainWindow( QWidget *parent)
    : QMainWindow(parent)
    {
    scene = new QGraphicsScene;
    Shapes *Square= new Shapes; //where Shapes is subclass of QGraphicsItem
    Shapes *Square1= new Shapes;

    scene->addItem (square);
    scene->addItem (square1);
    triangle->setPos(0,0);
    triangle1->setPos(100,60);

    view = new QGraphicsView(scene); //make sure always pass the QGraphicsScene
    view->setSceneRect(-400,-400,800,800);
    setCentralWidget(view);
    }
    Please see the attached image, even when I try to move square1 on square2 in the overlapped area always the
    square2 face will be exposed and square one will be hidden. Can somebody explain on how to solve this problem.
    I mean to say the square which has the mouse press event should be the top surface when it is overlapping with another square.
    Thanks in advance,
    Prasanna Bhat
    Attached Images Attached Images
    Last edited by boss_bhat; 27th January 2007 at 15:22. Reason: removed unwanted data

Similar Threads

  1. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  2. QGraphicsItem problem - how to save items info ??
    By aamer4yu in forum Qt Programming
    Replies: 3
    Last Post: 17th October 2006, 12:17
  3. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.