Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
InformationDockElementBaseStrategy< T > Class Template Reference

A generic InformationDockElementStrategy for specific TimedElements. More...

#include <InformationDockElementBaseStrategy.hpp>

Inheritance diagram for InformationDockElementBaseStrategy< T >:
Inheritance graph
[legend]
Collaboration diagram for InformationDockElementBaseStrategy< T >:
Collaboration graph
[legend]

Public Member Functions

virtual T * applicable (TimedElement *t)
 Checks if the strategy is applicable for an element and returns the casted element if so. More...
 
void setup (QFormLayout *layout) override
 Sets up the QFormLayout. More...
 
virtual void updateView (QFormLayout *layout, T *element)
 Updates the view. More...
 
bool update (QFormLayout *layout, TimedElement *element) override
 Sets up the QFormLayout. More...
 
std::string title () override
 Returns the title the information dock should show. More...
 
virtual void setup (QFormLayout *)
 Sets up the QFormLayout. More...
 
virtual bool update (QFormLayout *, TimedElement *)
 Updates the view to show details about a newly selected element. More...
 
virtual std::string title ()
 Returns the title the information dock should show. More...
 

Static Public Member Functions

static QString tr (const char *s, const char *c=nullptr, int n=-1)
 

Protected Attributes

TimeUnitLabelstartField = nullptr
 
TimeUnitLabelendField = nullptr
 
TimeUnitLabelruntimeField = nullptr
 

Detailed Description

template<class T>
requires std::is_base_of_v<TimedElement, T>
class InformationDockElementBaseStrategy< T >

A generic InformationDockElementStrategy for specific TimedElements.

This class abstracts a type check for selected elements. Derived classes can specify with the template parameter for which type of element they visualise information. Derived classes can overwrite the updateView function and get the selected element casted to their accepted type if it is of their accepted type.

Template Parameters
TType of TimedElement derived strategies accept

Definition at line 34 of file InformationDockElementBaseStrategy.hpp.

Member Function Documentation

◆ applicable()

template<class T >
virtual T * InformationDockElementBaseStrategy< T >::applicable ( TimedElement t)
inlinevirtual

Checks if the strategy is applicable for an element and returns the casted element if so.

By default this function does a dynamic_cast to check whether the strategy is applicable to for the element. A derived class can overwrite this behaviour if there are other options to identify the runtime type.

Parameters
tThe newly selected element.
Returns
The selected element casted to T if the strategy accepts the element or nullptr if it does not

Definition at line 53 of file InformationDockElementBaseStrategy.hpp.

◆ setup()

template<class T >
requires std::is_base_of_v<TimedElement, T>
void InformationDockElementBaseStrategy< T >::setup ( QFormLayout *  layout)
overridevirtual

Sets up the QFormLayout.

In derived classes this function should be overwritten and fields and rows should be added to the form layout.

Parameters
layoutThe layout of the detailed window pane

Reimplemented from InformationDockElementStrategy.

Definition at line 23 of file InformationDockElementBaseStrategy.cpp.

◆ title()

template<class T >
requires std::is_base_of_v<TimedElement, T>
std::string InformationDockElementBaseStrategy< T >::title
overridevirtual

Returns the title the information dock should show.

Returns
The title for the information dock should show

Reimplemented from InformationDockElementStrategy.

Definition at line 59 of file InformationDockElementBaseStrategy.cpp.

◆ tr()

template<class T >
static QString InformationDockElementBaseStrategy< T >::tr ( const char *  s,
const char *  c = nullptr,
int  n = -1 
)
inlinestatic
See also
QObject::tr()

Definition at line 39 of file InformationDockElementBaseStrategy.hpp.

◆ update()

template<class T >
requires std::is_base_of_v<TimedElement, T>
bool InformationDockElementBaseStrategy< T >::update ( QFormLayout *  layout,
TimedElement element 
)
overridevirtual

Sets up the QFormLayout.

In derived classes this function should be overwritten and fields and rows should be added to the form layout.

Parameters
layoutThe layout of the detailed window pane

Reimplemented from InformationDockElementStrategy.

Definition at line 49 of file InformationDockElementBaseStrategy.cpp.

◆ updateView()

template<class T >
requires std::is_base_of_v<TimedElement, T>
void InformationDockElementBaseStrategy< T >::updateView ( QFormLayout *  layout,
T *  element 
)
virtual

Updates the view.

Derived classes should overwrite this function but call the base implementation as it updates the time fields. The element pointer is guaranteed to be not null.

Parameters
layoutThe layout of the detailed window pane
elementThe newly selected element

Definition at line 35 of file InformationDockElementBaseStrategy.cpp.

Member Data Documentation

◆ endField

template<class T >
TimeUnitLabel* InformationDockElementBaseStrategy< T >::endField = nullptr
protected

The end field displaying the end time of the element

Definition at line 83 of file InformationDockElementBaseStrategy.hpp.

◆ runtimeField

template<class T >
TimeUnitLabel* InformationDockElementBaseStrategy< T >::runtimeField = nullptr
protected

The runtime field displaying the runtime of the element

Definition at line 84 of file InformationDockElementBaseStrategy.hpp.

◆ startField

template<class T >
TimeUnitLabel* InformationDockElementBaseStrategy< T >::startField = nullptr
protected

The start field displaying the start time of the element

Definition at line 82 of file InformationDockElementBaseStrategy.hpp.


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