Media.h header
#include <ew/core/Media.h>
Namespace ew::core
Media class
class ew::core::Media
A media asset in the project – an image, audio clip, video, PDF, or other file. The asset itself lives in the project's assets/ folder; a Media object records its kind, a project-relative path to the file, and an editable caption. Galleries, image annotation, and the research canvas are built on Media objects.
Members
ew::core::Media::Media(ContentId id, MediaKind kind, QString caption)
Creates a media object of kind with identity id and caption (no asset path).
MediaKind ew::core::Media::kind() const
The media kind (image/audio/video/pdf/other).
void ew::core::Media::setKind(MediaKind kind)
Sets the media kind.
const QString & ew::core::Media::caption() const
The caption / display title shown in galleries and captions.
void ew::core::Media::setCaption(QString caption)
Sets the media caption / display title.
const QString & ew::core::Media::assetPath() const
The project-relative path to the asset file (e.g. "assets/cover.png"); empty until the asset is imported.
void ew::core::Media::setAssetPath(QString assetPath)
Sets the project-relative path to the asset file.
const std::vector< MediaAnnotation > & ew::core::Media::annotations() const
The annotations drawn over the image (empty for non-image media), in draw order.
void ew::core::Media::addAnnotation(MediaAnnotation annotation)
Appends annotation to the end of the annotation list.
void ew::core::Media::insertAnnotation(std::size_t index, MediaAnnotation annotation)
Inserts annotation at position index (clamped to the current count). Used to restore a removed annotation at its original position.
bool ew::core::Media::removeAnnotation(std::size_t index)
Removes the annotation at index; returns true if the index was in range.
const std::optional< MediaCrop > & ew::core::Media::cropRect() const
The non-destructive crop applied to the image – the visible region in image pixels – or std::nullopt to show the whole image. The asset file itself is never modified.
void ew::core::Media::setCropRect(std::optional< MediaCrop > crop)
Sets the non-destructive crop (std::nullopt shows the whole image).