Refactor using Fable
This commit is contained in:
90 files changed
+2080
-2267
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <QAtomicInt>
|
||||
#include <QImage>
|
||||
#include <QQuickImageResponse>
|
||||
#include <QRunnable>
|
||||
|
||||
// Generic async image response: runs the given job on a thread pool and
|
||||
// publishes the resulting image. Shared by all image providers.
|
||||
class AsyncImageResponse : public QQuickImageResponse, public QRunnable {
|
||||
// NO Q_OBJECT — already inherited from QQuickImageResponse
|
||||
public:
|
||||
explicit AsyncImageResponse(std::function<QImage()> job);
|
||||
|
||||
QQuickTextureFactory *textureFactory() const override;
|
||||
void cancel() override;
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
std::function<QImage()> m_job;
|
||||
QAtomicInt m_cancelled{0};
|
||||
QImage m_image;
|
||||
};
|
||||
Reference in new issue
Block a user