Results 1 to 5 of 5

Thread: sending image one class to another class

  1. #1
    Join Date
    Jun 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default sending image one class to another class

    when sending the image from one class to another class application is crashing..


    Code..
    Qt Code:
    1. if(http_id == id && http->lastResponse().statusCode() == 200)
    2. {
    3. QPixmap image;
    4. QCache<QString,QPixmap>imageCache;
    5.  
    6. QByteArray imagedata = buffer->data();
    7. image.loadFromData(imagedata);
    8.  
    9. imageCache.insert(requestByEntry.key(id),&image);
    10. Form f;
    11. f.set(*imageCache[URL]);
    12. buffer->close();
    13. }
    To copy to clipboard, switch view to plain text mode 


    Qt Code:
    1. void Form::set( const QPixmap image)
    2. {
    3. m_ui->label->setPixmap(image);
    4. this->show();
    5.  
    6. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: sending image one class to another class

    You are storing a pointer to a local object that gets destroyed when you leave the block of code. Store objects instead of pointers to them.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QWaitCondition: Destroyed while threads are still waiting

    Hi

    When i am running my application , In console i am getting

    QWaitCondition: Destroyed while threads are still waiting


    Then application is automatically closed..

    I am using http links in my code..

    if i use the QmessageBox ,that time is not showing , and application is not closed..


    Qt Code:
    1. m_ui->setupUi( this );
    2. m_ui->blockbutton->hide();
    3. m_ui->callbutton->hide();
    4. m_ui->followbutton->hide();
    5. m_ui->retweetbutton->hide();
    6.  
    7. //QMessageBox::information(0,"get image function",QString("url link got"));
    8. m_ui->userName->setText(""+str);
    9. m_ui->userStatus->setHtml(""+str2);
    10. m_ui->label->setPixmap(image);
    11. //m_ui->userImage->setPixmap(image);
    12.  
    13. m_ui->label->setMouseTracking(true);
    14. m_ui->label->installEventFilter(this);
    15. m_ui->callbutton->setIcon(QIcon("../Image/all.png"));
    16. m_ui->blockbutton->setIcon(QIcon("../Image/65.png"));
    17. m_ui->followbutton->setIcon(QIcon("../Image/follow.png"));
    18. m_ui->retweetbutton->setIcon(QIcon("../Image/68.png"));
    To copy to clipboard, switch view to plain text mode 
    if i disable the message box that time application is closed

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QWaitCondition: Destroyed while threads are still waiting

    Do you use threads in your application?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: sending image one class to another class

    No, I didn't use the threads..


    Recently I used thead in above mentioned function..

    QThread::wait(5000);

    But nothing happened...

Similar Threads

  1. Issues writing a simple image viewer class
    By ultim8 in forum Qt Programming
    Replies: 5
    Last Post: 27th March 2009, 13:50
  2. class QHBoxLayout
    By csvivek in forum Installation and Deployment
    Replies: 2
    Last Post: 10th April 2008, 07:57
  3. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  4. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 09:23
  5. Sending a image using QSocket & QServerSocket
    By machathu in forum Qt Programming
    Replies: 1
    Last Post: 28th March 2006, 12:23

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.