61 #include "QtGLViewerLayout.hh"
68 QtGLViewerLayout::QtGLViewerLayout (QGraphicsLayoutItem * _parent) :
69 QGraphicsLayout (_parent),
81 items_.remove(items_.indexOf(
wheelX_));
88 void QtGLViewerLayout::addWheelY (QGraphicsWidget *_item)
91 items_.remove(items_.indexOf(wheelY_));
98 void QtGLViewerLayout::addWheelZ (QGraphicsWidget *_item)
101 items_.remove(items_.indexOf(wheelZ_));
103 items_.append(_item);
110 return items_.size();
115 QGraphicsLayoutItem * QtGLViewerLayout::itemAt(
int _i)
const
117 if (_i < 0 || _i >= items_.size())
125 void QtGLViewerLayout::removeAt (
int _index)
127 if (_index < 0 || _index >= items_.size())
132 if (items_[_index] == wheelY_)
134 if (items_[_index] == wheelZ_)
137 items_.remove(_index);
142 QSizeF QtGLViewerLayout::sizeHint(Qt::SizeHint ,
const QSizeF & _constraint)
const
151 QGraphicsLayoutItem::setGeometry (rect);
159 if (!
wheelX_ || !wheelY_ || !wheelZ_)
162 QRectF r = contentsRect ();
163 float scale = qMin(300.0, qMin(r.width(), r.height())) / 300.0;
165 foreach (QGraphicsWidget *item, items_)
167 if (item->size() != item->preferredSize ())
168 item->resize (item->preferredSize ());
169 item->resetTransform();
170 item->setScale (scale);
174 r.bottom() - ((wheelY_->size().height() +
wheelX_->size().height()) * scale));
175 wheelY_->setPos (r.left() + (
wheelX_->size().width() * scale),
176 r.bottom() - (wheelY_->size().height() * scale));
177 wheelZ_->setPos (r.right() - (wheelZ_->size().width() * scale),
178 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.
void reLayout()
Recalculate layout.
virtual int count() const
Pure virtual functions that have to be implemented.
QGraphicsWidget * wheelX_
Items.