本文整理汇总了C++中ImageProcessor::start方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageProcessor::start方法的具体用法?C++ ImageProcessor::start怎么用?C++ ImageProcessor::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageProcessor
的用法示例。
在下文中一共展示了ImageProcessor::start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onReplyFinished
/**
* RatingsProcessor::onReplyFinished()
*
* Handler for the signal indicating the response for the previous network request.
*
* If the result was a success, it will start the thread of constructing the QImage object.
*/
void RatingsProcessor::onReplyFinished() {
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QString response;
if (reply) {
if (reply->error() == QNetworkReply::NoError) {
const int available = reply->bytesAvailable();
if (available > 0) {
const QByteArray data(reply->readAll());
// Setup the image processing thread
ImageProcessor *imageProcessor = new ImageProcessor(data);
/*
* Invoke our onProcessingFinished slot after the processing has finished.
* Since imageProcessor and 'this' are located in different threads we use 'QueuedConnection' to
* allow a cross-thread boundary invocation. In this case the QImage parameter is copied in a thread-safe way
* from the worker thread to the main thread.
*/
connect(imageProcessor, SIGNAL(finished(QImage)), this,
SLOT(onImageProcessingFinished(QImage)),
Qt::QueuedConnection);
imageProcessor->start();
}
} else {
if (reply->error() < 100) {
m_loading = false;
emit loadingChanged();
showError("Please check your internet connection");
return;
}
m_label =
tr("Error: %1 status: %2").arg(reply->errorString(),
reply->attribute(
QNetworkRequest::HttpStatusCodeAttribute).toString());
emit labelChanged();
m_loading = false;
emit loadingChanged();
emit ratValueChanged();
}
reply->deleteLater();
} else {
m_label = tr("Download failed.");
emit labelChanged();
m_loading = false;
emit loadingChanged();
emit ratValueChanged();
}
}