Results 1 to 3 of 3

Thread: QPixmap display on QGraphicsScene

  1. #1
    Join Date
    Feb 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPixmap display on QGraphicsScene

    In the below code i need to display images on 10 ImageViewer items. But i got image only on first ImageViewer. As per my analysis, it is working on QWidget instead of QGraphicsScene. and also it will display text on all ImageViewer items, issue is only on QPixmap. Please solve this issue.
    class ImageViewer : public QGraphicsScene
    {
    ImageViewer( QString csImagePath_i )
    {
    QPixmap *pPixmap = new QPixmap( csImagePath );// "/tmp/1image" );
    QGraphicsPixmapItem *pPixMapItem = new QGraphicsPixmapItem( m_pPixmap );
    addItem( m_pPixMapItem );
    }
    }


    QGraphicsScene *m_pGraphicsScene = new QGraphicsScene;
    QGraphicsView *m_pGraphicsView = new QGraphicsView( m_pGraphicsScene );
    QGraphicsGridLayout* m_pGridLayout = new QGraphicsGridLayout();
    QGraphicsWidget* m_pGraphicsWidget = new QGraphicsWidget;
    m_pGraphicsWidget->setLayout( m_pGridLayout );
    m_pGraphicsScene->addItem( m_pGraphicsWidget );
    for( int nVal =0; nVal < 10; nVal++ )
    {
    ImageViewer* pImageView = new ImageViewer( "/tmp/Image1" );
    QGraphicsWidget *pGraphicsWidget = (QGraphicsWidget *)m_pGraphicsScene->addWidget( pImageView );
    pGraphicsWidget->setMinimumSize( QSize( 500,500 ));
    m_pGridLayout->addItem( pGraphicsWidget, nRow, nCol );
    nCol++;
    }

  2. #2
    Join Date
    Feb 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPixmap display on QGraphicsScene

    The scenario is shown below
    1. Create QGraphicsScene object;
    2. Set QPixmap on the above created object.
    3. Add it in to another QGraphicsScene.
    4. Coninue the above steps multiple times.
    5. There the image shown only on first added item.
    6. If we add into QWidget it will working fine
    7. Is there any issues in QGraphicsScene added on another QGraphicsScene

  3. #3
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QPixmap display on QGraphicsScene

    Hi

    I'am looking at. I'll report back as soon as it's done.

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. Replies: 2
    Last Post: 29th September 2008, 00:08
  3. Display only PNG image on desktop
    By durbrak in forum Qt Programming
    Replies: 32
    Last Post: 15th March 2008, 21:55
  4. WYSISYG display in QGraphicsScene
    By manojmka in forum Qt Programming
    Replies: 2
    Last Post: 10th December 2007, 06:14
  5. QPixmap and HBITMAP
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 16:24

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.