Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
omni::ui::mixin::Editor< WIDGET, EDITOR > Class Template Referenceabstract

Mixin for a widget that holds an editor widget. More...

#include <Editor.h>

Public Types

typedef WIDGET widget_type
 Widget type. More...
 
typedef EDITOR editor_type
 Editor widget type, e.g. QDoubleSpinBox. More...
 

Public Member Functions

 Editor (widget_type *_widget)
 
template<typename T = editor_type>
T * createEditor ()
 Create editor with type. More...
 
editor_type const * editor () const
 Return pointer editor (const version) More...
 
editor_typeeditor ()
 Return pointer editor. More...
 
template<typename T >
T * editorAs ()
 Return editor as type T. More...
 
template<typename T >
T const * editorAs () const
 Return editor as type T (const version) More...
 
virtual void setEditorVisible (bool _visible)
 Set editor visibility and set focus. More...
 
void showEditor ()
 Show editor and set focus. More...
 
void hideEditor ()
 Hide editor. More...
 

Private Member Functions

virtual void editorSetup ()=0
 

Private Attributes

editor_typeeditor_ = nullptr
 
widget_typewidget_ = nullptr
 

Detailed Description

template<typename WIDGET, typename EDITOR>
class omni::ui::mixin::Editor< WIDGET, EDITOR >

Mixin for a widget that holds an editor widget.

Member Typedef Documentation

template<typename WIDGET, typename EDITOR>
typedef EDITOR omni::ui::mixin::Editor< WIDGET, EDITOR >::editor_type

Editor widget type, e.g. QDoubleSpinBox.

template<typename WIDGET, typename EDITOR>
typedef WIDGET omni::ui::mixin::Editor< WIDGET, EDITOR >::widget_type

Widget type.

Constructor & Destructor Documentation

template<typename WIDGET, typename EDITOR>
omni::ui::mixin::Editor< WIDGET, EDITOR >::Editor ( widget_type _widget)
inline
38 : widget_(_widget) {}
widget_type * widget_
Definition: Editor.h:105

Member Function Documentation

template<typename WIDGET, typename EDITOR>
template<typename T = editor_type>
T* omni::ui::mixin::Editor< WIDGET, EDITOR >::createEditor ( )
inline

Create editor with type.

43  {
44  if (editor_) return nullptr;
45 
46  editor_ = new T(widget_);
47  T *_e = editorAs<T>();
48  _e->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
49  _e->setStyleSheet("background : transparent");
50 
51  if (widget_->layout()) widget_->layout()->addWidget(_e);
52  editorSetup();
53  hideEditor();
54  return _e;
55  }
virtual void editorSetup()=0
widget_type * widget_
Definition: Editor.h:105
void hideEditor()
Hide editor.
Definition: Editor.h:98
editor_type * editor_
Definition: Editor.h:104
template<typename WIDGET, typename EDITOR>
editor_type const* omni::ui::mixin::Editor< WIDGET, EDITOR >::editor ( ) const
inline

Return pointer editor (const version)

58  {
59  return editor_;
60  }
editor_type * editor_
Definition: Editor.h:104
template<typename WIDGET, typename EDITOR>
editor_type* omni::ui::mixin::Editor< WIDGET, EDITOR >::editor ( )
inline

Return pointer editor.

63  {
64  return editor_;
65  }
editor_type * editor_
Definition: Editor.h:104
template<typename WIDGET, typename EDITOR>
template<typename T >
T* omni::ui::mixin::Editor< WIDGET, EDITOR >::editorAs ( )
inline

Return editor as type T.

70  {
71  return static_cast<T *>(editor_);
72  }
editor_type * editor_
Definition: Editor.h:104
template<typename WIDGET, typename EDITOR>
template<typename T >
T const* omni::ui::mixin::Editor< WIDGET, EDITOR >::editorAs ( ) const
inline

Return editor as type T (const version)

77  {
78  return static_cast<T const *>(editor_);
79  }
editor_type * editor_
Definition: Editor.h:104
template<typename WIDGET, typename EDITOR>
virtual void omni::ui::mixin::Editor< WIDGET, EDITOR >::editorSetup ( )
privatepure virtual
template<typename WIDGET, typename EDITOR>
void omni::ui::mixin::Editor< WIDGET, EDITOR >::hideEditor ( )
inline

Hide editor.

98  {
99  setEditorVisible(false);
100  }
virtual void setEditorVisible(bool _visible)
Set editor visibility and set focus.
Definition: Editor.h:82
template<typename WIDGET, typename EDITOR>
virtual void omni::ui::mixin::Editor< WIDGET, EDITOR >::setEditorVisible ( bool  _visible)
inlinevirtual

Set editor visibility and set focus.

82  {
83  if (!editor_) return;
84 
85  editor_->setVisible(_visible);
86 
87  if (_visible) {
88  editor_->setFocus();
89  }
90  }
editor_type * editor_
Definition: Editor.h:104
template<typename WIDGET, typename EDITOR>
void omni::ui::mixin::Editor< WIDGET, EDITOR >::showEditor ( )
inline

Show editor and set focus.

93  {
94  setEditorVisible(true);
95  }
virtual void setEditorVisible(bool _visible)
Set editor visibility and set focus.
Definition: Editor.h:82

Field Documentation

template<typename WIDGET, typename EDITOR>
editor_type* omni::ui::mixin::Editor< WIDGET, EDITOR >::editor_ = nullptr
private
template<typename WIDGET, typename EDITOR>
widget_type* omni::ui::mixin::Editor< WIDGET, EDITOR >::widget_ = nullptr
private

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