export fillWidth/fillHeight properties
with those should hopefully be possible to have widgets behaving like the taskbar
This commit is contained in:
parent
5e376058c8
commit
ea69577005
@ -473,6 +473,50 @@ int AppletInterface::apiVersion() const
|
||||
return offers.first()->property("X-KDE-PluginInfo-Version", QVariant::Int).toInt();
|
||||
}
|
||||
|
||||
bool AppletInterface::fillWidth() const
|
||||
{
|
||||
if (!m_qmlObject->rootObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QVariant prop;
|
||||
|
||||
if (m_compactUiObject) {
|
||||
prop = m_compactUiObject.data()->property("fillWidth");
|
||||
} else {
|
||||
prop = m_qmlObject->rootObject()->property("fillWidth");
|
||||
}
|
||||
|
||||
if (prop.isValid() && prop.canConvert<bool>()) {
|
||||
return prop.toBool();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool AppletInterface::fillHeight() const
|
||||
{
|
||||
if (!m_qmlObject->rootObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QVariant prop;
|
||||
|
||||
if (m_compactUiObject) {
|
||||
prop = m_compactUiObject.data()->property("fillHeight");
|
||||
} else {
|
||||
prop = m_qmlObject->rootObject()->property("fillHeight");
|
||||
}
|
||||
|
||||
if (prop.isValid() && prop.canConvert<bool>()) {
|
||||
return prop.toBool();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//private api, just an helper
|
||||
qreal AppletInterface::readGraphicsObjectSizeHint(const char *hint) const
|
||||
{
|
||||
@ -670,6 +714,13 @@ void AppletInterface::compactRepresentationCheck()
|
||||
connect(m_compactUiObject.data(), SIGNAL(implicitHeightChanged()),
|
||||
this, SIGNAL(implicitHeightChanged()));
|
||||
}
|
||||
|
||||
emit minimumWidthChanged();
|
||||
emit minimumHeightChanged();
|
||||
emit implicitWidthChanged();
|
||||
emit implicitHeightChanged();
|
||||
emit maximumWidthChanged();
|
||||
emit maximumHeightChanged();
|
||||
//failed to create UI, don't do anything, return in expanded status
|
||||
} else {
|
||||
m_expanded = true;
|
||||
@ -715,6 +766,13 @@ void AppletInterface::compactRepresentationCheck()
|
||||
this, SIGNAL(implicitHeightChanged()));
|
||||
}
|
||||
|
||||
emit minimumWidthChanged();
|
||||
emit minimumHeightChanged();
|
||||
emit implicitWidthChanged();
|
||||
emit implicitHeightChanged();
|
||||
emit maximumWidthChanged();
|
||||
emit maximumHeightChanged();
|
||||
|
||||
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
|
||||
m_compactUiObject.data()->deleteLater();
|
||||
|
||||
|
@ -73,8 +73,11 @@ class AppletInterface : public QQuickItem
|
||||
Q_PROPERTY(qreal minimumHeight READ minimumHeight NOTIFY minimumHeightChanged)
|
||||
Q_PROPERTY(qreal maximumWidth READ maximumWidth NOTIFY maximumWidthChanged)
|
||||
Q_PROPERTY(qreal maximumHeight READ maximumHeight NOTIFY maximumHeightChanged)
|
||||
Q_PROPERTY(qreal implicitWidth READ implicitWidth NOTIFY implicitWidthChanged)
|
||||
Q_PROPERTY(qreal implicitHeight READ implicitHeight NOTIFY implicitHeightChanged)
|
||||
//implicitWidth/height is already there
|
||||
//Q_PROPERTY(qreal implicitWidth READ implicitWidth NOTIFY implicitWidthChanged)
|
||||
//Q_PROPERTY(qreal implicitHeight READ implicitHeight NOTIFY implicitHeightChanged)
|
||||
Q_PROPERTY(bool fillWidth READ fillWidth NOTIFY fillWidthChanged)
|
||||
Q_PROPERTY(bool fillHeight READ fillHeight NOTIFY fillHeightChanged)
|
||||
|
||||
public:
|
||||
AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent = 0);
|
||||
@ -150,6 +153,8 @@ public:
|
||||
bool userConfiguring() const;
|
||||
int apiVersion() const;
|
||||
|
||||
bool fillWidth() const;
|
||||
bool fillHeight() const;
|
||||
qreal minimumWidth() const;
|
||||
qreal minimumHeight() const;
|
||||
qreal maximumWidth() const;
|
||||
@ -176,8 +181,10 @@ Q_SIGNALS:
|
||||
void minimumHeightChanged();
|
||||
void maximumWidthChanged();
|
||||
void maximumHeightChanged();
|
||||
void implicitWidthChanged();
|
||||
void implicitHeightChanged();
|
||||
//void implicitWidthChanged();
|
||||
//void implicitHeightChanged();
|
||||
void fillWidthChanged();
|
||||
void fillHeightChanged();
|
||||
|
||||
protected:
|
||||
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
|
||||
|
Loading…
x
Reference in New Issue
Block a user