support minimumSize in the compactRepresentation

This commit is contained in:
Marco Martin 2012-06-04 22:45:11 +02:00
parent 4698241d8d
commit 2084d29735
2 changed files with 28 additions and 0 deletions

View File

@ -44,6 +44,11 @@ void DeclarativeItemContainer::setDeclarativeItem(QDeclarativeItem *item, bool r
resize(item->width(), item->height());
connect(m_declarativeItem.data(), SIGNAL(widthChanged()), this, SLOT(widthChanged()));
connect(m_declarativeItem.data(), SIGNAL(heightChanged()), this, SLOT(heightChanged()));
QObject::connect(m_declarativeItem.data(), SIGNAL(minimumWidthChanged()), this, SLOT(minimumWidthChanged()));
QObject::connect(m_declarativeItem.data(), SIGNAL(minimumHeightChanged()), this, SLOT(minimumHeightChanged()));
minimumWidthChanged();
minimumHeightChanged();
}
QDeclarativeItem *DeclarativeItemContainer::declarativeItem() const
@ -86,4 +91,25 @@ void DeclarativeItemContainer::heightChanged()
resize(newSize);
}
void DeclarativeItemContainer::minimumWidthChanged()
{
if (!m_declarativeItem) {
return;
}
qreal minimumWidth = m_declarativeItem.data()->property("minimumWidth").toReal();
setMinimumWidth(minimumWidth);
}
void DeclarativeItemContainer::minimumHeightChanged()
{
if (!m_declarativeItem) {
return;
}
qreal minimumHeight = m_declarativeItem.data()->property("minimumHeight").toReal();
setMinimumHeight(minimumHeight);
}
#include "declarativeitemcontainer_p.moc"

View File

@ -44,6 +44,8 @@ protected:
protected Q_SLOTS:
void widthChanged();
void heightChanged();
void minimumWidthChanged();
void minimumHeightChanged();
private:
QWeakPointer<QDeclarativeItem> m_declarativeItem;