ImageAction

Qualified name: mv::gui::ImageAction

class ImageAction : public mv::gui::WidgetAction

Image widget action class (WIP)

For image display and storage

Author

Thomas Kroes

Public Types

enum WidgetFlag

Describes the widget configurations.

Values:

enumerator Preview
enumerator Loader

Image preview with a label widget.

Public Functions

Q_INVOKABLE ImageAction(QObject *parent, const QString &title, bool populateFilePickerCompleter = true)

Constructor.

Parameters:
  • parent – Pointer to parent object

  • title – Title of the action

  • populateFilePickerCompleter – Whether to create a QCompleter for _filePathAction in _filePickerAction

const QImage getImage() const

Get the current image.

void setImage(const QImage &image)

Set the current image.

Parameters:

image – Current image

void loadImage(const QString &filePath)

Load image from disk.

Parameters:

filePath – Path of the image on disk

virtual void fromVariantMap(const QVariantMap &variantMap) override

Load image action from variant.

Parameters:

variantMap – Variant representation of the image action

virtual QVariantMap toVariantMap() const override

Save image action to variant.

Returns:

Variant representation of the image action

void imageChanged(const QImage &image)

Signals that the current image changed.

Parameters:

image – Current image that changed

Protected Functions

virtual QWidget *getWidget(QWidget *parent, const std::int32_t &widgetFlags) override

Get widget representation of the image action.

Parameters:
  • parent – Pointer to parent widget

  • widgetFlags – Widget flags for the configuration of the widget (type)

Protected Attributes

StringAction _filePathAction

Current image.

StringAction _fileNameAction

String action which contains the last loaded file path.

FilePickerAction _filePickerAction

String action which contains the last loaded file name.

TriggerAction _previewAction

Action for loading the image from disk.

class LoaderWidget : public QWidget

Loader widget class for image action.

Protected Functions

LoaderWidget(QWidget *parent, ImageAction &imageAction)

Constructor.

Parameters:
  • parent – Pointer to parent widget

  • imageAction – Reference to image action

Protected Attributes

HorizontalGroupAction _groupAction

Pointer to owning image action.

Friends

friend class ImageAction
class PreviewWidget : public QLabel

Preview widget class for image action.

Protected Functions

PreviewWidget(QWidget *parent, ImageAction &imageAction)

Constructor.

Parameters:
  • parent – Pointer to parent widget

  • imageAction – Reference to image action

Friends

friend class ImageAction