LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::StdDataFilterMenuCreator Class Reference

Adds actions to handle some data with relevant IDataFilter plugins to a menu. More...

#include "stddatafiltermenucreator.h"

+ Inheritance diagram for LC::Util::StdDataFilterMenuCreator:
+ Collaboration diagram for LC::Util::StdDataFilterMenuCreator:

Public Member Functions

 StdDataFilterMenuCreator (const QVariant &data, IEntityManager *iem, QMenu *menu)
 Constructs the StdDataFilterMenuCreator. More...
 
const QByteArray & GetChosenPlugin () const
 Returns the ID of the chosen plugin. More...
 
const QByteArray & GetChosenVariant () const
 Returns the ID of the chosen data filter variant. More...
 

Detailed Description

Adds actions to handle some data with relevant IDataFilter plugins to a menu.

This class can be used to offer a list of possible variants of handling an piece of data (like selected text, image, and so on) to the user.

For example, a hypothetical text editor could handle context menu requests in the following way:

const auto iem = Proxy_->GetEntityManager (); // Proxy_ is a ICoreProxy_ptr object
QMenu menu;
const auto& image = GetSelectionImage (); // returns selected image part of a document as a QImage
new Util::StdDataFilterMenuCreator { image, iem, &menu };
const auto& text = GetSelectionText (); // returns selected text part of a document as a QString
new Util::StdDataFilterMenuCreator { text, iem, &menu };
menu.exec ();
See also
IDataFilter

Definition at line 44 of file stddatafiltermenucreator.h.

Constructor & Destructor Documentation

◆ StdDataFilterMenuCreator()

LC::Util::StdDataFilterMenuCreator::StdDataFilterMenuCreator ( const QVariant &  data,
IEntityManager iem,
QMenu *  menu 
)

Constructs the StdDataFilterMenuCreator.

The newly created StdDataFilterMenuCreator becomes a child of the passed menu, so there is no need to delete it explicitly.

The actions corresponding to the data filter plugins are appended to the end of the menu.

Parameters
[in]dataThe data to try to handle with IDataFilter plugins.
[in]iemThe IEntityManager object for obtaining the list of IDataFilter plugins.
[in]menuThe menu to add actions to.

Definition at line 37 of file stddatafiltermenucreator.cpp.

Member Function Documentation

◆ GetChosenPlugin()

const QByteArray & LC::Util::StdDataFilterMenuCreator::GetChosenPlugin ( ) const

Returns the ID of the chosen plugin.

Returns
The ID of the chosen plugin, or an empty QByteArray if no plugin is chosen yet.
See also
GetChosenVariant()

Definition at line 76 of file stddatafiltermenucreator.cpp.

◆ GetChosenVariant()

const QByteArray & LC::Util::StdDataFilterMenuCreator::GetChosenVariant ( ) const

Returns the ID of the chosen data filter variant.

The ID corresponds to the ID of the IDataFilter::FilterVariant structure.

Returns
The ID of the chosen data filter variant, or an empty QByteArray if no plugin is chosen yet.
See also
GetChosenVariant()
IDataFilter
IDataFilter::FilterVariant

Definition at line 81 of file stddatafiltermenucreator.cpp.


The documentation for this class was generated from the following files: