SHARE
TWEET

Untitled

a guest Jul 28th, 2017 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   QString fileName = QFileDialog::getOpenFileName(this,
  2.       tr("Open Image file"),
  3.       tr("Open desired Image file"),
  4.       tr("Images (*.png *.jpeg *.jpg *.tiff *.tif *.pbm *.pgm *.ppm *.pnm *.xbm *xpm *.bmp *.gif )"));
  5.  
  6.     if (fileName.isEmpty())
  7.       return;
  8.  
  9.     mImage = QImage(fileName);
  10.     mImage = mImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
  11.     mDisplayedImage = QImage(mImage.size(), mImage.format());
  12.  
  13.     bool valid = !mImage.isNull();
  14.  
  15.  
  16.     if (!valid) {
  17.       ui->imageLabel->setText(tr("No Image loaded!"));
  18.   }else{
  19.       ui->imageLabel->setPixmap(QPixmap::fromImage(mDisplayedImage));
  20.  
  21.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top