Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes
omni::ui::SubScreenItem Class Reference

Subscreen Item for which a tuning can be assigned. More...

#include <ScreenItem.h>

Collaboration diagram for omni::ui::SubScreenItem:
Collaboration graph
[legend]

Public Member Functions

 SubScreenItem ()
 
 SubScreenItem (ScreenItem *_parent, int _index)
 
omni::ui::proj::TuningtuningWidget ()
 Currently assigned tuning widget. More...
 
omni::ui::proj::Tuning const * tuningWidget () const
 Currently assigned tuning widget (const version) More...
 
void attachTuningWidget (omni::ui::proj::Tuning *_tuning)
 Attach tuning widget to this subscreen. More...
 
void detachTuningWidget ()
 Detach current tuning widget from this subscreen. More...
 
QRect rect () const
 Return rectangle of this subscreen item. More...
 
QSize size () const
 Return size of this subscreen. More...
 
ScreenItemparent ()
 Pointer to parent screen. More...
 
ScreenItem const * parent () const
 Const pointer to parent screen. More...
 
void paint (bool _hover, bool _drop, QColor _dropColor, QPainter &)
 Paint this item with painter. More...
 

Private Attributes

ScreenItemparent_ = nullptr
 
int index_ = -1
 
omni::ui::proj::TuningtuningWidget_ = nullptr
 

Detailed Description

Subscreen Item for which a tuning can be assigned.

Constructor & Destructor Documentation

omni::ui::SubScreenItem::SubScreenItem ( )
29  {}
omni::ui::SubScreenItem::SubScreenItem ( ScreenItem _parent,
int  _index 
)
31  :
32  parent_(_parent),
33  index_(_index)
34  {}
ScreenItem * parent_
Definition: ScreenItem.h:78
int index_
Definition: ScreenItem.h:79

Member Function Documentation

void omni::ui::SubScreenItem::attachTuningWidget ( omni::ui::proj::Tuning _tuning)

Attach tuning widget to this subscreen.

125  {
126  _tuningWidget->attachScreen(parent()->screen(), index_);
127  parent()->fullscreen_->attach(index_, _tuningWidget->fullscreenWidget());
128  tuningWidget_ = _tuningWidget;
129  parent()->screenSetup_.update();
130  }
ScreenSetup & screenSetup_
Definition: ScreenItem.h:144
omni::ui::proj::Tuning * tuningWidget_
Definition: ScreenItem.h:80
ScreenItem * parent()
Pointer to parent screen.
Definition: ScreenItem.cpp:37
QUniquePtr< FullScreen > fullscreen_
Definition: ScreenItem.h:146
int index_
Definition: ScreenItem.h:79
void omni::ui::SubScreenItem::detachTuningWidget ( )

Detach current tuning widget from this subscreen.

132  {
133  if (!tuningWidget_) return;
134 
135  parent()->fullscreen_->detach(index_);
137  tuningWidget_ = nullptr;
138  parent()->screenSetup_.update();
139  }
void detachScreen()
Detaches screen from this tuning Also triggered when QGuiApplication::screenAdded or QGuiApplication...
Definition: Tuning.cpp:253
ScreenSetup & screenSetup_
Definition: ScreenItem.h:144
omni::ui::proj::Tuning * tuningWidget_
Definition: ScreenItem.h:80
ScreenItem * parent()
Pointer to parent screen.
Definition: ScreenItem.cpp:37
QUniquePtr< FullScreen > fullscreen_
Definition: ScreenItem.h:146
omni::ui::proj::Tuning * tuningWidget()
Currently assigned tuning widget.
Definition: ScreenItem.cpp:114
int index_
Definition: ScreenItem.h:79
void omni::ui::SubScreenItem::paint ( bool  _hover,
bool  _drop,
QColor  _dropColor,
QPainter &  _p 
)

Paint this item with painter.

Draw diagonal stripes for drop

68  {
69  // Draw rectangle with tuning color
70  QColor _color = tuningWidget() !=
71  nullptr ? tuningWidget()->tuning()->color() : "#cccccc";
72 
73  if (_hover)
74  {
75  _color = _color.lighter(120);
76  }
77 
78  _p.setBrush(_color);
79  _p.setPen(QPen(_color.darker(200), 1));
80 
81  auto _rect = rect();
82  _p.drawRect(_rect);
83 
84  /// Draw diagonal stripes for drop
85  if (_drop && _hover)
86  {
87  QPixmap _pixmap(32, 32);
88  _pixmap.fill(_color);
89  QPainter _texP(&_pixmap);
90  _texP.setPen(QPen(_dropColor, 2));
91 
92  for (int i = -32; i <= 64; i += 8)
93  {
94  _texP.drawLine(i + 32, i - 32, i - 32, i + 32);
95  }
96  _texP.end();
97  QBrush _brush;
98  _brush.setTexture(_pixmap);
99  _p.setBrush(_brush);
100  _p.drawRect(_rect);
101  }
102 
103  // Draw resolution text
104  _p.setBrush(Qt::NoBrush);
105  _p.setPen(QPen(_color.darker(500), 1));
106 
107  // Resolution information string
108  QString _resStr =
109  QString("%1 x %2").arg(size().width()).arg(size().height());
110 
111  _p.drawText(_rect, Qt::AlignHCenter | Qt::AlignVCenter, _resStr);
112  }
QSize size() const
Return size of this subscreen.
Definition: ScreenItem.cpp:55
QColor color() const
Returns color for mapping.
Definition: Tuning.cpp:124
QRect rect() const
Return rectangle of this subscreen item.
Definition: ScreenItem.cpp:46
omni::ui::proj::Tuning * tuningWidget()
Currently assigned tuning widget.
Definition: ScreenItem.cpp:114
omni::proj::Tuning * tuning()
Return pointer to tuning.
Definition: TuningFromIndex.h:54
ScreenItem * omni::ui::SubScreenItem::parent ( )

Pointer to parent screen.

37  {
38  return parent_;
39  }
ScreenItem * parent_
Definition: ScreenItem.h:78
ScreenItem const * omni::ui::SubScreenItem::parent ( ) const

Const pointer to parent screen.

42  {
43  return parent_;
44  }
ScreenItem * parent_
Definition: ScreenItem.h:78
QRect omni::ui::SubScreenItem::rect ( ) const

Return rectangle of this subscreen item.

47  {
48  auto _r = parent_->rect(); // Parent rect
49  int _width = _r.width() / omni::proj::ScreenSetup::subScreenCountForScreen(
50  parent()->screen());
51 
52  return QRect(_r.x() + index_ * _width, _r.y(), _width, _r.height());
53  }
static int subScreenCountForScreen(QScreen const *)
Static method for getting subscreen count for screen Screen must not be nullptr! ...
Definition: ScreenSetup.cpp:136
ScreenItem * parent()
Pointer to parent screen.
Definition: ScreenItem.cpp:37
ScreenItem * parent_
Definition: ScreenItem.h:78
int index_
Definition: ScreenItem.h:79
QRect rect() const
Definition: ScreenItem.cpp:223
QSize omni::ui::SubScreenItem::size ( ) const

Return size of this subscreen.

56  {
57  auto _screen = parent()->screen();
58 
59  return QSize(
61  _screen->size().height());
62  }
QScreen const * screen() const
Screen this screen item is assigned to.
Definition: ScreenItem.cpp:171
static int subScreenWidthForScreen(QScreen const *)
Static method for getting subscreen width for screen Screen must not be nullptr! ...
Definition: ScreenSetup.cpp:158
ScreenItem * parent()
Pointer to parent screen.
Definition: ScreenItem.cpp:37
omni::ui::proj::Tuning * omni::ui::SubScreenItem::tuningWidget ( )

Currently assigned tuning widget.

115  {
116  return tuningWidget_;
117  }
omni::ui::proj::Tuning * tuningWidget_
Definition: ScreenItem.h:80
omni::ui::proj::Tuning const * omni::ui::SubScreenItem::tuningWidget ( ) const

Currently assigned tuning widget (const version)

120  {
121  return tuningWidget_;
122  }
omni::ui::proj::Tuning * tuningWidget_
Definition: ScreenItem.h:80

Field Documentation

int omni::ui::SubScreenItem::index_ = -1
private
ScreenItem* omni::ui::SubScreenItem::parent_ = nullptr
private
omni::ui::proj::Tuning* omni::ui::SubScreenItem::tuningWidget_ = nullptr
private

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