|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/freelayout.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
otakuto |
675691 |
#include <memory></memory>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// DummyLayout implementation
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DummyLayout::DummyLayout() { setSizeConstraint(QLayout::SetNoConstraint); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DummyLayout::~DummyLayout() {
|
|
otakuto |
675691 |
std::for_each(m_items.begin(), m_items.end(), std::default_delete<qlayoutitem>());</qlayoutitem>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QSize DummyLayout::sizeHint() const {
|
|
Shinya Kitaoka |
120a6e |
QRect geom, result;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QList<qlayoutitem *="">::const_iterator it, iEnd = m_items.end();</qlayoutitem>
|
|
Shinya Kitaoka |
120a6e |
for (it = m_items.begin(); it != iEnd; ++it) {
|
|
Shinya Kitaoka |
120a6e |
QLayoutItem *item = *it;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
geom = item->geometry();
|
|
Shinya Kitaoka |
120a6e |
geom.setSize(item->sizeHint());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
result |= geom;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return result.size();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// FreeLayout implementation
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void FreeLayout::setGeometry(const QRect &r) {
|
|
Shinya Kitaoka |
120a6e |
QList<qlayoutitem *="">::const_iterator it, iEnd = m_items.end();</qlayoutitem>
|
|
Shinya Kitaoka |
120a6e |
for (it = m_items.begin(); it != iEnd; ++it) {
|
|
Shinya Kitaoka |
120a6e |
QLayoutItem *item = *it;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const QRect &geom = item->geometry();
|
|
Shinya Kitaoka |
120a6e |
const QSize &sizeHint = item->sizeHint();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (geom.size() != sizeHint)
|
|
Shinya Kitaoka |
120a6e |
item->setGeometry(QRect(geom.topLeft(), sizeHint));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|