Results 1 to 7 of 7

Thread: QFileDialog prevents app from closing

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jul 2009
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFileDialog prevents app from closing

    A bizarre twist: I found that the problem goes away if I remove from the project a small file for converting between QImages and IPLImages (used in OpenCV)

    The file, which i found online, does not do anything that seems like it should be relevant to QFileDialog, here is the header:

    Qt Code:
    1. #ifndef QTIPL_H
    2. #define QTIPL_H
    3. #include <QImage>
    4. #include <highgui.h>
    5.  
    6. IplImage qtToCv(QImage* qImage);
    7. QImage cvToQt(IplImage* iplImage);
    8.  
    9. #endif // QTIPL_H
    To copy to clipboard, switch view to plain text mode 


    and cpp:
    Qt Code:
    1. #include "qtIPL.h"
    2.  
    3. IplImage qtToCv(QImage* qImage)
    4. {
    5. IplImage* cvImage;
    6. cvImage = cvCreateImageHeader(cvSize(qImage->width(), qImage->height()), IPL_DEPTH_8U, 4);
    7. cvImage->imageData = (char*)qImage->bits();
    8. IplImage* colorImage = cvCreateImage( cvGetSize(cvImage), 8, 3 );
    9. cvConvertImage( cvImage, colorImage, 0 );
    10.  
    11. return *colorImage;
    12. }
    13.  
    14. QImage cvToQt(IplImage* iplImage)
    15. {
    16. if(!cvSaveImage("tmpImg.bmp", iplImage)) printf("Could not save: tmpImg.bmp in cvToQt");
    17. QImage img("tmpImg.bmp");
    18. }
    To copy to clipboard, switch view to plain text mode 


    if anyone sees something wrong with this (or can recommend a similar way to convert between these two image formats) please let me know
    Last edited by jpn; 15th July 2009 at 22:10. Reason: missing [code] tags

Similar Threads

  1. Check for invalid file name in QFileDialog
    By darren in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2008, 14:43
  2. QFileDialog in Qt designer
    By tpf80 in forum Qt Tools
    Replies: 1
    Last Post: 17th May 2007, 00:41
  3. QFileDialog Mac / PC
    By hey in forum Qt Programming
    Replies: 3
    Last Post: 26th April 2007, 18:23
  4. ActiveWindow changes after closing QFileDialog
    By mischi in forum Qt Programming
    Replies: 3
    Last Post: 13th July 2006, 12:45
  5. copy file/s from QFileDialog
    By raphaelf in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 14:26

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.