QImage img; QFile ifile; QString str=ui->lineEdit->text(); if(!str.isEmpty()) { ifile.setFileName(str); if(!ifile.open(QIODevice::ReadOnly)) { QMessageBox::warning(this,tr("Klaida"),tr("Can't open file")); return; } //img.load(str); QDataStream stream(&ifile); stream.setVersion(QDataStream::Qt_4_3); stream>>img; if(stream.status()!=QDataStream::Ok) { QMessageBox::warning(this,tr("Klaida"),tr("Can't draw file context")); return; }//-------- для отладки-проверка открытия файла if(img.isNull()) { QMessageBox::warning(this,tr("Klaida"),tr("Can't move file context")); return; }//----------- ui->label->setPixmap(QPixmap::fromImage(img)); ifile.close(); }