Results 1 to 4 of 4

Thread: weird problem in QGraphicsView / QGraphicsScene

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    39
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default weird problem in QGraphicsView / QGraphicsScene

    i've a weird problem, i want to display an image (size 1024x150) in the bottom of my application window. It's a QGraphicsScene inside a QGraphicsView, my main window is 1024x768 size, first i tried to add the image as this:

    Qt Code:
    1. bottom_widget = new QLabel;
    2. bottom_widget->setPixmap( QPixmap( "images/bottom.png" ) );
    3. bottom_proxy = scene.addWidget( botbar_widget );
    4. bottom_proxy->setPos( 0, 618 );
    5. bottom_proxy->setZValue( 1 );
    6. bottom_proxy->setAttribute( Qt::WA_DeleteOnClose, true );
    To copy to clipboard, switch view to plain text mode 

    and the result was this:
    see _Image001.jpg

    part of the image on the right is grey? don't have a clue why, it should be the same colour/pattern of the rest of the image.

    if i move the image to the left, putting something like this:
    Qt Code:
    1. bottom_proxy->setPos( -512, 618 );
    To copy to clipboard, switch view to plain text mode 
    the right part of the image displays ok

    now, if i try to add the image using QGraphicsPixmapItem method:

    Qt Code:
    1. bottom_Item = new QGraphicsPixmapItem( 0, &scene );
    2. bottom_Item->setPixmap( QPixmap( "images/bottom.png" ) );
    3. bottom_Item->setPos( 0, 618 );
    4. bottom_Item->setZValue( 1 );
    To copy to clipboard, switch view to plain text mode 

    the image displays on the mainwindow as it should be, no grey area on the right but now
    when i try to exit from that part of my application (and bottom_item is removed from the scene and deleted), the first time it works fine (it's removed/deleted ok), when i enter again that section of my application and it displays the same image, when i then try to exit from that part, the application crashes in this line:

    Qt Code:
    1. qvector.h
    2. inline void detach() { if (d->ref != 1) detach_helper(); }
    To copy to clipboard, switch view to plain text mode 

    but, if again if move the item to the left, ( position -512, 618 ), it doesn't crash.
    so, first time works fine, second time it crashes in the above section.

    sorry if this seems confusing, for long hours i tried to spot what causes this weird problem but at this time i don't have any clue.

    i'm using qt 4.5.0

    thanks in advance
    Attached Files Attached Files

Similar Threads

  1. Replies: 1
    Last Post: 11th June 2009, 05:49
  2. QPrinter on QGraphicsScene Border Problem
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2007, 15:49
  3. QGraphicsView scrolling problem with 4.3.0
    By hb in forum Qt Programming
    Replies: 8
    Last Post: 30th August 2007, 22:18
  4. Weird problem while porting from Qt3 to Qt4
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 07:51
  5. Problem with QGraphicsView.
    By kiranraj in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2007, 19:44

Tags for this Thread

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.