Loading...
Searching...
No Matches
OutletPreviewLayer.hpp
1#pragma once
2#include <Effect/EffectLayer.hpp>
3
4#include <Gfx/Widgets/TexturePreview.hpp>
5
6#include <QImage>
7#include <QString>
8#include <QPointer>
9
10#include <functional>
11#include <optional>
12
13#include <score_plugin_gfx_export.h>
14
15namespace Gfx
16{
24class SCORE_PLUGIN_GFX_EXPORT OutletPreviewLayer : public Process::EffectLayerView
25{
26public:
28 const Process::ProcessModel& process, const Process::Context& doc,
29 QGraphicsItem* parent, std::size_t texture_outlet = 0);
30 ~OutletPreviewLayer() override;
31
33 std::function<std::optional<double>()> aspect;
35 QString placeholder;
36
38 QRectF imageRect() const;
39 const TexturePreview& preview() const noexcept { return m_preview; }
40
41protected:
42 void paint_impl(QPainter* p) const override;
43 void timerEvent(QTimerEvent* ev) override;
45 virtual void paintOverlay(QPainter* p, const QRectF& image) const { }
46
47private:
48 void refresh();
51 void updateTimer();
52
53 const Process::ProcessModel& m_process;
54 std::size_t m_outlet{};
55 QPointer<GfxContext> m_context;
56 TexturePreview m_preview;
57 int m_timer{};
58 int m_interval{-1};
59};
60}
Definition OutletPreviewLayer.hpp:25
QString placeholder
Shown when there is no image yet.
Definition OutletPreviewLayer.hpp:35
std::function< std::optional< double >()> aspect
Width over height of the image; nothing: fill the view.
Definition OutletPreviewLayer.hpp:33
virtual void paintOverlay(QPainter *p, const QRectF &image) const
Drawn over the image.
Definition OutletPreviewLayer.hpp:45
What a texture outlet produces, as an image any view can paint: an inspector widget,...
Definition TexturePreview.hpp:33
Definition EffectLayer.hpp:17
The Process class.
Definition score-lib-process/Process/Process.hpp:82
Binds the rendering pipeline to ossia processes.
Definition AssetTable.cpp:7
Definition ProcessContext.hpp:12