Results 1 to 5 of 5

Thread: Release program failed to show jpg image on another PC!

  1. #1
    Join Date
    Aug 2008
    Posts
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Release program failed to show jpg image on another PC!

    I have release my program and package the program with installshield, and installed the package program on another PC that without QT and VS installed, everything is sames fine. I have a dialog to show image, this dialog can show jpg,png and other format image on my developing environment PC, however, it only show png image correctly on the other PC ! I had package the qgif4.dll, qjpeg4.dll and corresponding dlls to my program. the fellowing is my codes, these codes for showing images was rewriten as the QtDemo/SQL/Drill down example.
    Qt Code:
    1. // ImageItem.cpp
    2. #include "ImageItem.h"
    3.  
    4. CImageItem::CImageItem( QGraphicsItem *parent, QGraphicsScene *scene)
    5. : QGraphicsPixmapItem(parent, scene)
    6. {
    7. setAcceptsHoverEvents(false);
    8. timeLine.setDuration(150);
    9. timeLine.setFrameRange(0, 150);
    10.  
    11. connect(&timeLine, SIGNAL(frameChanged(int)), this, SLOT(setFrame(int)));
    12. connect(&timeLine, SIGNAL(finished()), this, SLOT(updateItemPosition()));
    13. }
    14.  
    15. void CImageItem::setItem(int w,int h,const QPixmap &pixmap)
    16. {
    17. m_nW = w, m_nH = h;
    18. setPixmap(pixmap);
    19. adjust();
    20. }
    21.  
    22. void CImageItem::hoverEnterEvent(QGraphicsSceneHoverEvent * /*event*/)
    23. {
    24. timeLine.setDirection(QTimeLine::Forward);
    25.  
    26. if (z != 1.0)
    27. {
    28. z = 1.0;
    29. updateItemPosition();
    30. }
    31.  
    32. if (timeLine.state() == QTimeLine::NotRunning)
    33. timeLine.start();
    34. }
    35.  
    36. void CImageItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
    37. {
    38. timeLine.setDirection(QTimeLine::Backward);
    39. if (z != 0.0) z = 0.0;
    40.  
    41. if (timeLine.state() == QTimeLine::NotRunning)
    42. timeLine.start();
    43. }
    44.  
    45. void CImageItem::setFrame(int frame)
    46. {
    47. adjust();
    48. QPointF center = boundingRect().center();
    49.  
    50. translate(center.x(), center.y());
    51. scale(1 + frame / 550.0f, 1 + frame / 550.0f); // here change the scale
    52. translate(-center.x(), -center.y());
    53. }
    54.  
    55. void CImageItem::adjust()
    56. {
    57. QMatrix matrix;
    58. matrix.scale(m_nW/ boundingRect().width(), m_nH/ boundingRect().height());
    59. setMatrix(matrix);
    60. }
    61.  
    62. void CImageItem::updateItemPosition()
    63. {
    64. setZValue(z);
    65. }
    To copy to clipboard, switch view to plain text mode 

    and ImageView.cpp is here:
    Qt Code:
    1. #include "ImageView.h"
    2. #include "ImageItem.h"
    3.  
    4. CImageView::CImageView(int imgWidth,int imgHight,int offsetX,int offsetY,QWidget *parent): QGraphicsView(parent)
    5. {
    6. m_nW = imgWidth,m_nH = imgHight;
    7. m_pGraphScene = new QGraphicsScene(this);
    8. m_pImageItem = new CImageItem;
    9. setScene(m_pGraphScene);
    10. m_pImageItem->setPos(offsetX,offsetY);
    11. m_pGraphScene->addItem(m_pImageItem);
    12. setRect(imgWidth,imgHight,offsetX,offsetY);
    13. }
    14.  
    15. CImageView::~CImageView()
    16. {
    17.  
    18. }
    19.  
    20. void CImageView::setRect(int imgWidth,int imgHight,int offsetX,int offsetY)
    21. {
    22. int frameWidth = imgWidth + offsetX * 2 + 2;
    23. int frameHight = imgHight + offsetY * 2 + 2;
    24. m_pGraphScene->setSceneRect(0,0,imgWidth+2*offsetX, imgHight+offsetY*2);
    25. }
    26.  
    27. void CImageView::showImage(const QString& szName)
    28. {
    29. if(!QFile::exists(szName))
    30. {
    31. AlarmBox(tr("Image File 【%1】 Not Found!").arg(szName));
    32. return ;
    33. }
    34. m_pImageItem->setItem(m_nW,m_nH,QPixmap(szName));
    35. }
    To copy to clipboard, switch view to plain text mode 

    when I want to show a image, call showImage(path) instead. and on my main.cpp, I had setted envrionment path like this:
    Qt Code:
    1. QStringList pathList=QApplication::libraryPaths();
    2. pathList.append(QDir::current().absolutePath()+"/plugins");
    3. pathList.append(QApplication::applicationDirPath()+"/plugins");
    4. QApplication::setLibraryPaths(pathList);
    To copy to clipboard, switch view to plain text mode 
    and in the program install folder, the files struct is like this:
    D:\PROGRAM FILES\FLOWERDATABASE
    │ DatabaseConfig.ini
    │ FlowerDatabase.exe
    │ Mainframe_zh.qm
    │ Microsoft.VC90.CRT.manifest
    │ msvcm90.dll
    │ msvcp90.dll
    │ msvcr90.dll

    ├─Backup
    │ SQL2000_Init.bak
    │ SQL2005_Init.bak

    ├─Config
    │ style.txt

    ├─Database
    └─Plugins
    ├─codecs
    │ qcncodecs4.dll
    │ qgif4.dll
    │ qjpeg4.dll
    │ qtiff4.dll
    │ qtwcodecs4.dll

    └─sqldrivers
    qsqlite4.dll
    qsqlmysql4.dll
    qsqloci4.dll
    qsqlodbc4.dll
    It's sames everythis is OK, I don't know what's the matter! Anything help is appreciate!

  2. #2
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: Release program failed to show jpg image on another PC!

    Copy qjpeg4.dll in plugins directory not in codecs directory

  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Release program failed to show jpg image on another PC!

    image formats plugins should be in APP_ROOT_DIR/imageformats

    P.S. Please search the forum next time, as this question appears once a week and the answer is always the same.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  4. #4
    Join Date
    Aug 2008
    Posts
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Release program failed to show jpg image on another PC!

    Thank you for your suggestion, I will be carefull next time, and you are right, the image dll should be in a "imageformats" folder. another name may failed.

  5. #5
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: Release program failed to show jpg image on another PC!

    Oh right. I'm wrong. In imageformats folder

    Sorry

Similar Threads

  1. Program works in Release but not Debug
    By Ferric in forum Newbie
    Replies: 2
    Last Post: 28th January 2010, 01:08
  2. Replies: 2
    Last Post: 27th August 2009, 20:31
  3. Saving image in jpeg format failed
    By febil in forum Qt Programming
    Replies: 5
    Last Post: 23rd April 2009, 11:33
  4. Release my simple program to other users ?
    By probine in forum Qt Programming
    Replies: 9
    Last Post: 9th July 2006, 23:42
  5. preparing program for release
    By impeteperry in forum Installation and Deployment
    Replies: 5
    Last Post: 22nd April 2006, 19:30

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.