Results 1 to 2 of 2

Thread: Image Viewer for multiple images

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Unhappy Image Viewer for multiple images

    I am having name of images in a stringlist "imageList", stringlist "imageTypeList" to hold type of images and size of this list in "imageListSize" now i want to view the images one after other at the time lag of 5 seconds,i have written code to implement this,my images were residing on the server :

    void Viewer::imageViewer()
    {
    timer->stop();
    if(!imageList.isEmpty())
    {
    if(imageListSize>=0)
    {
    buffer.open(QIODevice::ReadWrite);
    QString fileName = imagelist[imageListSize];
    imageftp=new QFtp(this);
    imageftp->connectToHost("190.111.111.1");
    imageftp->login("user","passwd");
    imageftp->cd("media");
    imageftp->get(fileName, &buffer);
    connect(imageftp, SIGNAL(commandFinished(int, bool)),this, SLOT(ftpCommandFinished(int, bool)));
    }
    }

    }



    void Viewer::ftpCommandFinished(int, bool)
    {
    timer=new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(imageViewer()));
    timer->start(5000);
    buffer.open(QIODevice::ReadWrite);
    QByteArray data=buffer.data();
    QByteArray type;
    type.insert(0,imageTypeList[imageListSize]);
    if(!imageftp->hasPendingCommands())
    {
    QImageReader reader(&buffer, type);
    QImage image = reader.read();
    imageui.imageLabel->setPixmap(QPixmap::fromImage(image));
    idialog.show();
    }
    imageListSize--;
    imageViewer();
    }


    Above code produces segmentation fault,help me out...
    Last edited by sinha.ashish; 25th April 2008 at 11:48.
    @shish

  2. The following user says thank you to sinha.ashish for this useful post:

    thaihoangluu (22nd December 2011)

  3. #2
    Join Date
    Jan 2006
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Image Viewer for multiple images

    At a glance, it seems like the timer is initialized in ftpCommandFinished, but is stopped in imageViewer. Does the timer variable have a default value the first time imageViewer() is called?

Similar Threads

  1. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  2. Replies: 3
    Last Post: 11th March 2007, 13:04
  3. Requirement for versatile image viewer
    By deekayt in forum General Discussion
    Replies: 1
    Last Post: 27th October 2006, 14:28
  4. Image Viewer
    By sumsin in forum Qt Programming
    Replies: 3
    Last Post: 14th March 2006, 13:29

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.