QUrl url
("http://103.3.229.181/digital-photo-frame-ads/public/getImages");
//this link contains two images QNetworkAccessManager manager;
QNetworkReply
*response
= manager.
get(QNetworkRequest
(QUrl(url
)));
connect(response,SIGNAL(finished()),&event,SLOT(quit()));
event.exec();
QString html
= response
->readAll
();
if(html.length() > 0){
str = html.split(",");
for (int i = 0; i < str.size(); ++i)
{
pic
=pic.
remove(QRegExp(QString::fromUtf8("[`~!@#$%^&*()_—+=|;<>«»,?{}\'\"\\\[\\\]\\\\]")));
pixmap.loadFromData(jpegData);
QPixmap scaled
= pixmap.
scaled(128,
64,Qt
::IgnoreAspectRatio, Qt
::FastTransformation);
l.setPixmap(scaled);
l.show();
QString filename
= QFileDialog::getSaveFileName(this, tr
("Save Skin"),
"/home/ihorse1/10-03-2015",tr
("JPEG Image(*.jpg)"));
out << reply;
qDebug()<<out;
file.close();
}
}
QUrl url("http://103.3.229.181/digital-photo-frame-ads/public/getImages");//this link contains two images
QNetworkAccessManager manager;
QNetworkReply *response = manager.get(QNetworkRequest(QUrl(url)));
QEventLoop event;
connect(response,SIGNAL(finished()),&event,SLOT(quit()));
event.exec();
QString html = response->readAll();
if(html.length() > 0){
QStringList str;
str = html.split(",");
for (int i = 0; i < str.size(); ++i)
{
pic=pic.remove(QRegExp(QString::fromUtf8("[`~!@#$%^&*()_—+=|;<>«»,?{}\'\"\\\[\\\]\\\\]")));
QByteArray jpegData = pic.toLocal8Bit();
QPixmap pixmap;
pixmap.loadFromData(jpegData);
QPixmap scaled = pixmap.scaled(128,64,Qt::IgnoreAspectRatio, Qt::FastTransformation);
l.setPixmap(scaled);
l.show();
QString filename = QFileDialog::getSaveFileName(this, tr("Save Skin"), "/home/ihorse1/10-03-2015",tr("JPEG Image(*.jpg)"));
QFile file (filename);
file.open(QIODevice::WriteOnly);
QDataStream out (&file);
out << reply;
qDebug()<<out;
file.close();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks