Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes
omni::ui::AbstractInputWidget Class Reference

Input widget with an editor widget. More...

#include <AbstractInputWidget.h>

Inheritance diagram for omni::ui::AbstractInputWidget:
Inheritance graph
[legend]
Collaboration diagram for omni::ui::AbstractInputWidget:
Collaboration graph
[legend]

Public Types

typedef mixin::Editor
< AbstractInputWidget, QWidget > 
mixin_editor_type
 

Public Slots

virtual void setEditorVisible (bool)
 Set editor visible. More...
 
void showEditor ()
 Show editor. More...
 
void hideEditor ()
 Hide editor. More...
 

Signals

void valueChanged ()
 Value changed event. More...
 

Public Member Functions

 AbstractInputWidget (QWidget *=nullptr)
 
virtual ~AbstractInputWidget ()
 
- Public Member Functions inherited from omni::ui::Widget
 Widget (QWidget *=nullptr)
 
 Widget (QString const &_label, QWidget *=nullptr)
 
virtual ~Widget ()
 
QString label () const
 Return label text of widget. More...
 
void setLabel (QString const &)
 Set label text of widget. More...
 
ColorSet const & colorSet () const
 
double zoomFactor () const
 Zoom factor of widget. More...
 

Protected Member Functions

virtual void mouseDoubleClickEvent (QMouseEvent *)
 Show editor on double click. More...
 
virtual void mousePressEvent (QMouseEvent *)
 Hide editor and set focus on click. More...
 
virtual void keyPressEvent (QKeyEvent *)
 Show editor when enter key is pressed. More...
 
void drawHandle (QPainter &_p, double _pos, double _heightFactor=1.0) const
 Draw slider handle. More...
 
void drawTrack (QPainter &_p, double _pos) const
 
void drawTrack (QPainter &_p, double _left, double _right) const
 
void init ()
 
- Protected Member Functions inherited from omni::ui::Widget
void drawBorder (QPainter &)
 
void drawBorder (QPainter &, bool _focus)
 
- Protected Member Functions inherited from omni::ui::mixin::Editor< AbstractInputWidget, QWidget >
 Editor (widget_type *_widget)
 
T * createEditor ()
 Create editor with type. More...
 
editor_type const * editor () const
 Return pointer editor (const version) More...
 
editor_typeeditor ()
 Return pointer editor. More...
 
T * editorAs ()
 Return editor as type T. More...
 
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...
 

Protected Attributes

QLabel * valueLabel_ = nullptr
 
- Protected Attributes inherited from omni::ui::Widget
QLabel * label_
 

Additional Inherited Members

- Protected Types inherited from omni::ui::mixin::Editor< AbstractInputWidget, QWidget >
typedef AbstractInputWidget widget_type
 Widget type. More...
 
typedef QWidget editor_type
 Editor widget type, e.g. QDoubleSpinBox. More...
 

Detailed Description

Input widget with an editor widget.

Member Typedef Documentation

Constructor & Destructor Documentation

omni::ui::AbstractInputWidget::AbstractInputWidget ( QWidget *  _parent = nullptr)
28  :
29  Widget(_parent),
30  mixin_editor_type(this)
31  {
32  init();
33  }
mixin::Editor< AbstractInputWidget, QWidget > mixin_editor_type
Definition: AbstractInputWidget.h:36
void init()
Definition: AbstractInputWidget.cpp:35
Widget(QWidget *=nullptr)
Definition: Widget.cpp:30
virtual omni::ui::AbstractInputWidget::~AbstractInputWidget ( )
inlinevirtual
38 {}

Member Function Documentation

void omni::ui::AbstractInputWidget::drawHandle ( QPainter &  _p,
double  _pos,
double  _heightFactor = 1.0 
) const
protected

Draw slider handle.

90  {
91  QRectF _progressRect = rect();
92 
93  _progressRect.setRight(_pos);
94  _p.setPen(QPen(colorSet().dark(), 4));
95  _p.drawLine(
96  QPointF(_pos, _progressRect.bottom() + 2),
97  QPointF(_pos,
98  _progressRect.bottom() - _heightFactor *
99  _progressRect.height() - 2));
100  }
ColorSet const & colorSet() const
Definition: Widget.cpp:56
void omni::ui::AbstractInputWidget::drawTrack ( QPainter &  _p,
double  _pos 
) const
protected
120  {
121  drawTrack(_p, rect().left(), _pos);
122  }
void drawTrack(QPainter &_p, double _pos) const
Definition: AbstractInputWidget.cpp:119
void omni::ui::AbstractInputWidget::drawTrack ( QPainter &  _p,
double  _left,
double  _right 
) const
protected
105  {
106  QRectF _progressRect = rect();
107 
108  _p.setBrush(QBrush(colorSet().window()));
109  _p.drawRect(_progressRect);
110 
111  if (_left > _right) std::swap(_left, _right);
112 
113  _progressRect.setLeft(_left);
114  _progressRect.setRight(_right);
115  _p.setBrush(QBrush(colorSet().highlight()));
116  _p.drawRect(_progressRect);
117  }
ColorSet const & colorSet() const
Definition: Widget.cpp:56
void omni::ui::AbstractInputWidget::hideEditor ( )
slot

Hide editor.

64  {
66  }
void hideEditor()
Hide editor.
Definition: Editor.h:98
void omni::ui::AbstractInputWidget::init ( )
protected
36  {
37  valueLabel_ = new QLabel("", this);
38  valueLabel_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
39  valueLabel_->setSizePolicy(QSizePolicy::Expanding,
40  QSizePolicy::Expanding);
41  valueLabel_->setStyleSheet("background : transparent; color: #808080;");
42  layout()->addWidget(valueLabel_);
43  }
QLabel * valueLabel_
Definition: AbstractInputWidget.h:78
void omni::ui::AbstractInputWidget::keyPressEvent ( QKeyEvent *  e)
protectedvirtual

Show editor when enter key is pressed.

Reimplemented in omni::ui::RangedFloat, and omni::ui::RangedInt.

80  {
81  if (((e->key() == Qt::Key_Enter) || (e->key() == Qt::Key_Return)))
82  {
83  setEditorVisible(!editor()->hasFocus());
84  }
85  }
editor_type const * editor() const
Return pointer editor (const version)
Definition: Editor.h:58
virtual void setEditorVisible(bool)
Set editor visible.
Definition: AbstractInputWidget.cpp:45
void omni::ui::AbstractInputWidget::mouseDoubleClickEvent ( QMouseEvent *  )
protectedvirtual

Show editor on double click.

Reimplemented in omni::ui::RangedFloat.

75  {
76  showEditor();
77  }
void showEditor()
Show editor.
Definition: AbstractInputWidget.cpp:58
void omni::ui::AbstractInputWidget::mousePressEvent ( QMouseEvent *  )
protectedvirtual

Hide editor and set focus on click.

Reimplemented in omni::ui::RangedFloat, and omni::ui::RangedInt.

69  {
70  setFocus();
71  hideEditor();
72  }
void hideEditor()
Hide editor.
Definition: AbstractInputWidget.cpp:63
void omni::ui::AbstractInputWidget::setEditorVisible ( bool  _visible)
virtualslot

Set editor visible.

46  {
48 
49  valueLabel_->setVisible(!_visible);
50 
51  if (!_visible)
52  {
53  setFocus();
54  return;
55  }
56  }
virtual void setEditorVisible(bool _visible)
Set editor visibility and set focus.
Definition: Editor.h:82
QLabel * valueLabel_
Definition: AbstractInputWidget.h:78
void omni::ui::AbstractInputWidget::showEditor ( )
slot

Show editor.

59  {
61  }
void showEditor()
Show editor and set focus.
Definition: Editor.h:93
void omni::ui::AbstractInputWidget::valueChanged ( )
signal

Value changed event.

Field Documentation

QLabel* omni::ui::AbstractInputWidget::valueLabel_ = nullptr
protected

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