Got the error part thanks

I'll update my code:

.h File:
Qt Code:
  1. #ifndef MINECRAFTSKINDOWNLOADER_H
  2. #define MINECRAFTSKINDOWNLOADER_H
  3.  
  4. #include <QMainWindow>
  5. #include <QtNetwork/QNetworkReply>
  6. #include <QtNetwork/QNetworkAccessManager>
  7.  
  8. namespace Ui {
  9. class MinecraftSkinDownloader;
  10. }
  11.  
  12. class MinecraftSkinDownloader : public QMainWindow
  13. {
  14. Q_OBJECT
  15.  
  16. public:
  17. explicit MinecraftSkinDownloader(QWidget *parent = 0);
  18. ~MinecraftSkinDownloader();
  19. QByteArray pngData;
  20. QNetworkAccessManager *manager;
  21.  
  22. private slots:
  23.  
  24. void slot_netwManagerFinished(QNetworkReply *reply);
  25.  
  26. void onsaveAs_clicked();
  27.  
  28. void on_clear_clicked();
  29.  
  30. void on_pushButton_clicked();
  31.  
  32. private:
  33. Ui::MinecraftSkinDownloader *ui;
  34.  
  35.  
  36. };
  37.  
  38. #endif // MINECRAFTSKINDOWNLOADER_H
To copy to clipboard, switch view to plain text mode 

.cpp File
Qt Code:
  1. #include "minecraftskindownloader.h"
  2. #include "ui_minecraftskindownloader.h"
  3. #include <QWidget>
  4. #include <QObject>
  5. #include <QtNetwork/QNetworkAccessManager>
  6. #include <QFileDialog>
  7. #include <QtNetwork/QNetworkRequest>
  8. #include <QDebug>
  9. #include <QUrl>
  10. #include <QFile>
  11. #include <QPixmap>
  12. #include <QMessageBox>
  13.  
  14. MinecraftSkinDownloader::MinecraftSkinDownloader(QWidget *parent) :
  15. QMainWindow(parent),
  16. ui(new Ui::MinecraftSkinDownloader)
  17. {
  18. ui->setupUi(this);
  19. this->setWindowTitle("Minecraft Skin Downloader");
  20. QIcon icon(":/ico");
  21. setWindowIcon(icon);
  22. setFixedSize(400, 200);
  23. setStyleSheet("QMainWindow { background-image: url(:/bg.png); } ");
  24.  
  25. connect(ui->save, SIGNAL(clicked()), this, SLOT(onsaveAs_clicked()));
  26.  
  27. }
  28.  
  29. MinecraftSkinDownloader::~MinecraftSkinDownloader()
  30. {
  31. delete ui;
  32. }
  33.  
  34. //http://s3.amazonaws.com/MinecraftSkins/USERNAMEHERE.png
  35.  
  36. void MinecraftSkinDownloader::on_pushButton_clicked()
  37. {
  38. QString prefix = "http://s3.amazonaws.com/MinecraftSkins/";
  39. QString usrl = prefix += ui->lineEdit->text() += ".png";
  40.  
  41. //QNetworkAccessManager *manager = new QNetworkAccessManager(this);
  42. connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slot_netwManagerFinished(QNetworkReply*)));
  43.  
  44. QUrl url(usrl);
  45. QNetworkRequest request(url);
  46.  
  47. manager->get(request);
  48.  
  49. }
  50.  
  51. void MinecraftSkinDownloader::slot_netwManagerFinished(QNetworkReply *reply)
  52. {
  53.  
  54. if (reply->error() != QNetworkReply::NoError)
  55. {
  56. qDebug() << "Error in" << reply->url() << ":" << reply->errorString();
  57. QPixmap noUsr(":/voidUser.png"); // Void User path
  58. ui->preview->show();
  59. ui->preview->setStyleSheet("background: transparent;");
  60. ui->preview->setPixmap(noUsr);
  61. reply->deleteLater();
  62. return;
  63. }
  64.  
  65. pngData = reply->readAll();
  66. QPixmap pixmap;
  67. pixmap.loadFromData(pngData);
  68. QPixmap scaled = pixmap.scaled(128,64,Qt::IgnoreAspectRatio, Qt::FastTransformation);
  69. ui->preview->show();
  70. ui->preview->setStyleSheet("QLabel { background-color: white; }");
  71. ui->preview->setPixmap(scaled);
  72. reply->deleteLater();
  73.  
  74. }
  75.  
  76. void MinecraftSkinDownloader::onsaveAs_clicked()
  77. {
  78. if(pngData.isEmpty())
  79. {
  80. ui->preview->show();
  81. QPixmap error(":/noSaveData.png");
  82. ui->preview->setPixmap(error);
  83. return;
  84. }
  85.  
  86. QString filename = QFileDialog::getSaveFileName(this, tr("Save Skin"), "C:/Users/", ("PNG Image (*.png)"));
  87.  
  88. QFile file(filename);
  89. file.open(QIODevice::WriteOnly);
  90. file.write(pngData);
  91. file.close();
  92. }
  93.  
  94. void MinecraftSkinDownloader::on_clear_clicked()
  95. {
  96. pngData.clear();
  97. ui->preview->setStyleSheet("background: transparent;");
  98. ui->lineEdit->clear();
  99. ui->preview->hide();
  100. return;
  101. }
To copy to clipboard, switch view to plain text mode 

It crashes the moment I press that on_pushButton_clicked(), and doesn't even get to display the error message (voidUser.png) when I leave it blank. Same thing happens when I put a valid username in there too.