61 #include "QtMultiViewLayout.hh"
68 QtMultiViewLayout::QtMultiViewLayout (QGraphicsLayoutItem * _parent) :
69 QGraphicsLayout (_parent),
101 if ((
int) _i >
count ())
121 for (
int i = 0; i < 4; i++)
130 QGraphicsLayoutItem * QtMultiViewLayout::itemAt(
int _i)
const
132 if (_i < 0 || _i > 3)
139 void QtMultiViewLayout::removeAt (
int _index)
141 if (_index < 0 || _index > 3)
148 QSizeF QtMultiViewLayout::sizeHint(Qt::SizeHint ,
const QSizeF & _constraint)
const
157 QGraphicsLayoutItem::setGeometry (rect);
166 QRectF r = contentsRect ();
173 if (mode == SingleView)
175 for (
int i = 0; i < 4; i++)
178 }
else if ( mode == DoubleView) {
179 for (
int i = 0; i < 2; i++)
182 for (
int i = 2; i < 4; i++)
186 for (
int i = 0; i < 4; i++)
198 int width = (r.width() -
spacing_) / 2;
199 int height = r.height();
200 items_[0]->resize (width, height);
201 items_[1]->resize (width, height);
203 items_[0]->setPos(r.topLeft());
209 int width = (r.width() -
spacing_) / 2;
210 int height = (r.height() -
spacing_) / 2;
211 items_[0]->resize (width, height);
215 items_[0]->setPos (r.topLeft());
225 for (
unsigned int i = 0, j = 1; i < 4; i++)
228 int width = (r.width() -
spacing_) * 3 / 4;
229 int ewidth = r.width() -
spacing_ - width;
230 int eheight = (r.height() - (
spacing_ * 2)) / 3;
231 items_[order[0]]->resize (width, r.height());
232 items_[order[1]]->resize (ewidth, eheight);
233 items_[order[2]]->resize (ewidth, eheight);
234 items_[order[3]]->resize (ewidth, r.height() - ((eheight +
spacing_) * 2));
235 items_[order[0]]->setPos (r.topLeft());
239 r.y() + ((eheight +
spacing_) * 2));
void reLayout()
Recalculate layout.
virtual void setGeometry(const QRectF &rect)
Tracks geometry changes.
void addItem(QGraphicsWidget *_item, unsigned int _pos)
Adds Widget to Layout.
virtual int count() const
Pure virtual functions that have to be implemented.
MultiViewMode mode() const
Retruns current layout modes.
MultiViewMode
MultiView display modes.
unsigned int primary_
Primary element.
void setSpacing(unsigned int _s)
Sets space between items.
void setPrimary(unsigned int _i)
Sets primary element for SingleView and HSplit.
MultiViewMode mode_
current modes
unsigned int spacing_
Spacing.
QGraphicsWidget * items_[4]
Items.
void setMode(MultiViewMode _mode)
Sets layout mode.