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

A single parameter widget with a label and color set. More...

#include <Widget.h>

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

Public Member Functions

 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

void drawBorder (QPainter &)
 
void drawBorder (QPainter &, bool _focus)
 

Protected Attributes

QLabel * label_
 

Private Member Functions

void init ()
 

Private Attributes

ColorSet colorSet_
 
double zoomFactor_ = 1.0
 

Detailed Description

A single parameter widget with a label and color set.

Constructor & Destructor Documentation

omni::ui::Widget::Widget ( QWidget *  _parent = nullptr)
30  :
31  QWidget(_parent),
32  colorSet_(this)
33  {
34  init();
35  }
ColorSet colorSet_
Definition: Widget.h:60
void init()
Definition: Widget.cpp:61
omni::ui::Widget::Widget ( QString const &  _label,
QWidget *  _parent = nullptr 
)
37  :
38  QWidget(_parent),
39  colorSet_(this)
40  {
41  init();
42  setLabel(_label);
43  }
ColorSet colorSet_
Definition: Widget.h:60
void setLabel(QString const &)
Set label text of widget.
Definition: Widget.cpp:50
void init()
Definition: Widget.cpp:61
virtual omni::ui::Widget::~Widget ( )
inlinevirtual
38 {}

Member Function Documentation

ColorSet const & omni::ui::Widget::colorSet ( ) const
57  {
58  return colorSet_;
59  }
ColorSet colorSet_
Definition: Widget.h:60
void omni::ui::Widget::drawBorder ( QPainter &  _p)
protected
80  {
81  drawBorder(_p, hasFocus());
82  }
void drawBorder(QPainter &)
Definition: Widget.cpp:79
void omni::ui::Widget::drawBorder ( QPainter &  _p,
bool  _focus 
)
protected
85  {
86  auto && _rect = rect();
87 
88  QStyleOption _option;
89  _option.initFrom(this);
90 
91  _p.setPen(_focus ? QPen(QBrush(_option.palette.color(colorSet().
92  colorGroup(),
93  QPalette::Dark)),
94  2) : Qt::NoPen);
95  _p.setBrush(Qt::NoBrush);
96  _p.drawRect(_rect);
97  }
ColorSet const & colorSet() const
Definition: Widget.cpp:56
void omni::ui::Widget::init ( )
private
62  {
63  setWindowFlags(Qt::FramelessWindowHint);
64  setMinimumSize(0, 24 / devicePixelRatio());
65  setMaximumSize(16000, 48 / devicePixelRatio());
66  setFocusPolicy(Qt::TabFocus);
67  label_ = new QLabel("", this);
68  label_->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
69  label_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
70  label_->setStyleSheet("background : transparent; color: #808080;");
71  label_->setPalette(this->palette());
72 
73  QLayout *_layout = new QHBoxLayout(this);
74  _layout->setContentsMargins(4, 1, 4, 1);
75  _layout->addWidget(label_);
76  setLayout(_layout);
77  }
QLabel * label_
Definition: Widget.h:55
QString omni::ui::Widget::label ( ) const

Return label text of widget.

46  {
47  return label_->text();
48  }
QLabel * label_
Definition: Widget.h:55
void omni::ui::Widget::setLabel ( QString const &  _label)

Set label text of widget.

51  {
52  label_->setText(_label);
53  update();
54  }
QLabel * label_
Definition: Widget.h:55
double omni::ui::Widget::zoomFactor ( ) const

Zoom factor of widget.

Field Documentation

ColorSet omni::ui::Widget::colorSet_
private
QLabel* omni::ui::Widget::label_
protected
double omni::ui::Widget::zoomFactor_ = 1.0
private

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