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:
bottom_widget
->setPixmap
( QPixmap( "images/bottom.png" ) );
bottom_proxy = scene.addWidget( botbar_widget );
bottom_proxy->setPos( 0, 618 );
bottom_proxy->setZValue( 1 );
bottom_proxy->setAttribute( Qt::WA_DeleteOnClose, true );
bottom_widget = new QLabel;
bottom_widget->setPixmap( QPixmap( "images/bottom.png" ) );
bottom_proxy = scene.addWidget( botbar_widget );
bottom_proxy->setPos( 0, 618 );
bottom_proxy->setZValue( 1 );
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:
bottom_proxy->setPos( -512, 618 );
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:
bottom_Item
->setPixmap
( QPixmap( "images/bottom.png" ) );
bottom_Item->setPos( 0, 618 );
bottom_Item->setZValue( 1 );
bottom_Item = new QGraphicsPixmapItem( 0, &scene );
bottom_Item->setPixmap( QPixmap( "images/bottom.png" ) );
bottom_Item->setPos( 0, 618 );
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:
qvector.h
inline void detach() { if (d->ref != 1) detach_helper(); }
qvector.h
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
Bookmarks