Use QQuickItem::implicit{Width,Height}

... instead of overriding the property.

Removes a warning whenever the implicit width and height changes, and
reduces the API footprint of AppletInterface.
This commit is contained in:
Sebastian Kügler 2013-12-28 03:43:22 +01:00
parent e5ad29dabf
commit a50398f433
2 changed files with 15 additions and 21 deletions

View File

@ -539,16 +539,6 @@ qreal AppletInterface::maximumHeight() const
return readGraphicsObjectSizeHint("maximumHeight");
}
qreal AppletInterface::implicitWidth() const
{
return readGraphicsObjectSizeHint("implicitWidth");
}
qreal AppletInterface::implicitHeight() const
{
return readGraphicsObjectSizeHint("implicitHeight");
}
void AppletInterface::setAssociatedApplication(const QString &string)
{
applet()->setAssociatedApplication(string);
@ -791,19 +781,17 @@ void AppletInterface::compactRepresentationCheck()
if (m_qmlObject->rootObject()->property("implicitWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(implicitWidthChanged()),
this, SIGNAL(implicitWidthChanged()));
this, SLOT(updateImplicitWidth()));
}
if (m_qmlObject->rootObject()->property("implicitHeight").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(implicitHeightChanged()),
this, SIGNAL(implicitHeightChanged()));
this, SLOT(updateImplicitHeight()));
}
emit fillWidthChanged();
emit fillHeightChanged();
emit minimumWidthChanged();
emit minimumHeightChanged();
emit implicitWidthChanged();
emit implicitHeightChanged();
emit maximumWidthChanged();
emit maximumHeightChanged();
@ -819,6 +807,17 @@ void AppletInterface::compactRepresentationCheck()
}
}
void AppletInterface::updateImplicitWidth()
{
setImplicitWidth(readGraphicsObjectSizeHint("implicitWidth"));
}
void AppletInterface::updateImplicitHeight()
{
setImplicitHeight(readGraphicsObjectSizeHint("implicitHeight"));
}
void AppletInterface::updatePopupSize()
{
KConfigGroup cg = applet()->config();

View File

@ -148,9 +148,6 @@ 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)
//FIXME?implicitWidth/height is already there
Q_PROPERTY(qreal implicitWidth READ implicitWidth NOTIFY implicitWidthChanged)
Q_PROPERTY(qreal implicitHeight READ implicitHeight NOTIFY implicitHeightChanged)
/**
* If the plasmoid is in a linear layout, such as a panel, it indicates to take as much horizontal space as possible
@ -290,8 +287,6 @@ public:
qreal minimumHeight() const;
qreal maximumWidth() const;
qreal maximumHeight() const;
qreal implicitWidth() const;
qreal implicitHeight() const;
Q_SIGNALS:
/**
@ -322,8 +317,6 @@ Q_SIGNALS:
void minimumHeightChanged();
void maximumWidthChanged();
void maximumHeightChanged();
void implicitWidthChanged();
void implicitHeightChanged();
void fillWidthChanged();
void fillHeightChanged();
void userConfiguringChanged();
@ -340,6 +333,8 @@ protected Q_SLOTS:
private Q_SLOTS:
void compactRepresentationCheck();
void updatePopupSize();
void updateImplicitWidth();
void updateImplicitHeight();
private:
//Helper for minimumWidth etc.