2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2020-03-24 13:51:16 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QtCore/qobject.h>
|
|
|
|
|
#include <QtCore/qstring.h>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2020-11-17 17:56:45 +02:00
|
|
|
class QQuickWindow;
|
2020-03-24 13:51:16 +02:00
|
|
|
class QQuickItem;
|
2022-07-11 14:10:13 +02:00
|
|
|
class QQuickDesignerSupport;
|
2020-11-17 17:56:45 +02:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
|
class QQuickRenderControl;
|
|
|
|
|
class QRhi;
|
|
|
|
|
class QRhiTexture;
|
|
|
|
|
class QRhiRenderBuffer;
|
|
|
|
|
class QRhiTextureRenderTarget;
|
|
|
|
|
class QRhiRenderPassDescriptor;
|
|
|
|
|
#endif
|
2020-03-24 13:51:16 +02:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
class IconRenderer : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit IconRenderer(int size, const QString &filePath, const QString &source);
|
2022-07-12 11:58:02 +02:00
|
|
|
~IconRenderer();
|
2020-03-24 13:51:16 +02:00
|
|
|
|
|
|
|
|
void setupRender();
|
|
|
|
|
|
|
|
|
|
private:
|
2021-06-29 16:10:01 +03:00
|
|
|
void startCreateIcon();
|
|
|
|
|
void focusCamera();
|
|
|
|
|
void finishCreateIcon();
|
2020-03-24 13:51:16 +02:00
|
|
|
void render(const QString &fileName);
|
2020-11-17 17:56:45 +02:00
|
|
|
void resizeContent(int dimensions);
|
|
|
|
|
bool initRhi();
|
2020-03-24 13:51:16 +02:00
|
|
|
|
|
|
|
|
int m_size = 16;
|
|
|
|
|
QString m_filePath;
|
|
|
|
|
QString m_source;
|
2020-11-17 17:56:45 +02:00
|
|
|
QQuickWindow *m_window = nullptr;
|
2020-03-24 13:51:16 +02:00
|
|
|
QQuickItem *m_contentItem = nullptr;
|
2020-10-08 10:50:15 +03:00
|
|
|
QQuickItem *m_containerItem = nullptr;
|
2022-07-11 14:10:13 +02:00
|
|
|
std::unique_ptr<QQuickDesignerSupport> m_designerSupport;
|
2020-10-08 10:50:15 +03:00
|
|
|
bool m_is3D = false;
|
2021-06-29 16:10:01 +03:00
|
|
|
int m_focusStep = 0;
|
2020-11-17 17:56:45 +02:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
|
QQuickRenderControl *m_renderControl = nullptr;
|
|
|
|
|
QRhi *m_rhi = nullptr;
|
|
|
|
|
QRhiTexture *m_texture = nullptr;
|
|
|
|
|
QRhiRenderBuffer *m_buffer = nullptr;
|
|
|
|
|
QRhiTextureRenderTarget *m_texTarget = nullptr;
|
|
|
|
|
QRhiRenderPassDescriptor *m_rpDesc = nullptr;
|
|
|
|
|
#endif
|
2020-03-24 13:51:16 +02:00
|
|
|
};
|