55#include "QtGLViewerLayout.hh"
62QtGLViewerLayout::QtGLViewerLayout (QGraphicsLayoutItem * _parent) :
63 QGraphicsLayout (_parent),
75 items_.remove(items_.indexOf(
wheelX_));
82void QtGLViewerLayout::addWheelY (QGraphicsWidget *_item)
85 items_.remove(items_.indexOf(wheelY_));
92void QtGLViewerLayout::addWheelZ (QGraphicsWidget *_item)
95 items_.remove(items_.indexOf(wheelZ_));
104 return items_.size();
109QGraphicsLayoutItem * QtGLViewerLayout::itemAt(
int _i)
const
111 if (_i < 0 || _i >= items_.size())
119void QtGLViewerLayout::removeAt (
int _index)
121 if (_index < 0 || _index >= items_.size())
126 if (items_[_index] == wheelY_)
128 if (items_[_index] == wheelZ_)
131 items_.remove(_index);
136QSizeF QtGLViewerLayout::sizeHint(Qt::SizeHint ,
const QSizeF & _constraint)
const
145 QGraphicsLayoutItem::setGeometry (rect);
153 if (!
wheelX_ || !wheelY_ || !wheelZ_)
156 QRectF r = contentsRect ();
157 float scale = qMin(300.0, qMin(r.width(), r.height())) / 300.0;
159 foreach (QGraphicsWidget *item, items_)
161 if (item->size() != item->preferredSize ())
162 item->resize (item->preferredSize ());
163 item->resetTransform();
164 item->setScale (scale);
168 r.bottom() - ((wheelY_->size().height() +
wheelX_->size().height()) * scale));
169 wheelY_->setPos (r.left() + (
wheelX_->size().width() * scale),
170 r.bottom() - (wheelY_->size().height() * scale));
171 wheelZ_->setPos (r.right() - (wheelZ_->size().width() * scale),
172 r.bottom() - ((wheelY_->size().height() + wheelZ_->size().height()) * scale));
void addWheelX(QGraphicsWidget *_item)
Add Wheel Widget to Layout.
virtual void setGeometry(const QRectF &rect)
Tracks geometry changes.
virtual int count() const
Pure virtual functions that have to be implemented.
void reLayout()
Recalculate layout.
QGraphicsWidget * wheelX_
Items.