Created
          May 18, 2019 17:17 
        
      - 
      
- 
        Save jnareb/fa5074f1e5a082c4faf7272986088384 to your computer and use it in GitHub Desktop. 
    Ładowanie obrazów w Qt z pliku zewnętrznego do istniejącego QImage
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | void MainWindow::loadImageFromFile(QString filename, QImage *dstImage) | |
| { | |
| QImage *tempImage = new QImage(filename); | |
| *dstImage = tempImage->copy(0,0,dstImage->width(),dstImage->height()); | |
| delete tempImage; | |
| } | |
| void MainWindow::openImageFile(QImage *dstImage) | |
| { | |
| QString filename = QFileDialog::getOpenFileName( | |
| this, "Otwórz obraz", | |
| "..\\images", | |
| "Pliki graficzne (*.png *.jpg *.bmp)" | |
| ); | |
| if (!(filename.isNull())) { | |
| loadImageFromFile(filename, dstImage); | |
| update(); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment