Qimage failed to load file in pc which not install qt sdk



  • i use QImage to load jpg and png file as below code show,in my pc it ok,but when deploy to others not install qt sdk ,it failed to load the image,i don't know why,i had put the qtgui.dll and qtcore.dll in the fold.Any one can help me,thanks.

    @
    QString fileName = QDir::currentPath() +"/TopoLogy/images.png";
    QMessageBox::information(this, "image path", fileName);

    if (!fileName.isEmpty()) {
        QImage image(fileName);
        if (image.isNull()) {
            QMessageBox::information(this, tr("Image Viewer"),
                                     tr("Cannot load %1.").arg(fileName));
            return;
        }
    

    @

    [EDIT: code formatting, please wrap in @-tags, Volker]



  • it always show Image Viewer cannot laod ....



  • Hi,

    Kindly use the code formatter so that your code is readable. You can edit your post and add @ tags for the code.



  • Did you put (plugins\imageformats)plugin libs too?



  • Please copy the plugin

    from
    @
    $QTDIR/plugins/imageformats/*
    @

    to

    @
    YouApplicationDirectory/imageformats/*
    @



  • thanks
    [quote author="1+1=2" date="1335978596"]Please copy the plugin

    from
    @
    $QTDIR/plugins/imageformats/*
    @

    to

    @
    YouApplicationDirectory/imageformats/*
    @[/quote]



  • this code is copy from qt example
    [quote author="Soumitra" date="1335953992"]Hi,

    Kindly use the code formatter so that your code is readable. You can edit your post and add @ tags for the code.

    [/quote]



  • [quote author="kevin_wmy" date="1336355175"]this code is copy from qt example
    [quote author="Soumitra" date="1335953992"]Hi,

    Kindly use the code formatter so that your code is readable. You can edit your post and add @ tags for the code.

    [/quote]

    [/quote]

    Yes,
    I was just saying about using the code formatter i.e @-tags around your code so that it can be readable. You can check your first post, the @-tags have been added by Volker. BTW did you get the solution ?

    Thanks :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.