experiment support for panel auto resize

This commit is contained in:
Marco Martin 2013-09-06 18:36:12 +02:00
parent abbe19722f
commit 1b9d6cbb13
2 changed files with 67 additions and 0 deletions

View File

@ -92,6 +92,42 @@ void ContainmentInterface::init()
if (!m_appletInterfaces.isEmpty()) {
emit appletsChanged();
}
if (m_qmlObject->rootObject()->property("minimumWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(minimumWidthChanged()),
this, SIGNAL(minimumWidthChanged()));
}
if (m_qmlObject->rootObject()->property("minimumHeight").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(minimumHeightChanged()),
this, SIGNAL(minimumHeightChanged()));
}
if (m_qmlObject->rootObject()->property("maximumWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(maximumWidthChanged()),
this, SIGNAL(maximumWidthChanged()));
}
if (m_qmlObject->rootObject()->property("maximumHeight").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(maximumHeightChanged()),
this, SIGNAL(maximumHeightChanged()));
}
if (m_qmlObject->rootObject()->property("implicitWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(implicitWidthChanged()),
this, SIGNAL(implicitWidthChanged()));
}
if (m_qmlObject->rootObject()->property("implicitHeight").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(implicitHeightChanged()),
this, SIGNAL(implicitHeightChanged()));
}
emit fillWidthChanged();
emit fillHeightChanged();
emit minimumWidthChanged();
emit minimumHeightChanged();
emit implicitWidthChanged();
emit implicitHeightChanged();
emit maximumWidthChanged();
emit maximumHeightChanged();
}
QList <QObject *> ContainmentInterface::applets()

View File

@ -80,6 +80,37 @@ PlasmaCore.FrameSvgItem {
onLocationChanged: {
adjustBorders()
}
onMinimumWidthChanged: {
if (containment.formFactor === PlasmaCore.Types.Horizontal) {
panel.width = Math.max(panel.width, containment.minimumWidth);
}
}
onMaximumWidthChanged: {
if (containment.formFactor === PlasmaCore.Types.Horizontal) {
panel.width = Math.min(panel.width, containment.maximumWidth);
}
}
onImplicitWidthChanged: {
if (containment.formFactor === PlasmaCore.Types.Horizontal) {
panel.width = Math.min(containment.maximumWidth, Math.max(containment.implicitWidth, containment.minimumWidth));
}
}
onMinimumHeightChanged: {
if (containment.formFactor === PlasmaCore.Types.Vertical) {
panel.width = Math.max(panel.width, containment.minimumHeight);
}
}
onMaximumHeightChanged: {
if (containment.formFactor === PlasmaCore.Types.Vertical) {
panel.width = Math.min(panel.width, containment.maximumHeight);
}
}
onImplicitHeightChanged: {
if (containment.formFactor === PlasmaCore.Types.Vertical) {
panel.width = Math.min(containment.maximumHeight, Math.max(containment.implicitHeight, containment.minimumHeight));
}
}
}
Connections {