* make setSize virtual as well since it sets d->size internally, so Applet needs to intercept that call
* remove some dead code in widgets.cpp svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=773475
This commit is contained in:
parent
eb5e0658df
commit
eed0410c56
@ -1352,6 +1352,11 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
return Widget::itemChange(change, value);
|
||||
}
|
||||
|
||||
void Applet::setSize(const QSizeF &size)
|
||||
{
|
||||
setGeometry(QRectF(pos(), size));
|
||||
}
|
||||
|
||||
void Applet::setGeometry(const QRectF& geometry)
|
||||
{
|
||||
Plasma::Constraints updatedConstraints(0);
|
||||
@ -1361,7 +1366,9 @@ void Applet::setGeometry(const QRectF& geometry)
|
||||
qreal width = qBound(minimumSize().width(), geometry.size().width(), maximumSize().width());
|
||||
qreal height = qBound(minimumSize().height(), geometry.size().height(), maximumSize().height());
|
||||
|
||||
setSize(QSizeF(width, height));
|
||||
// it is important we call Widget::setSize(QSizeF) here to avoid recursing back to this
|
||||
// method, creating an infinite loop
|
||||
Widget::setSize(QSizeF(width, height));
|
||||
|
||||
if (layout()) {
|
||||
layout()->setGeometry(QRectF(QPoint(0, 0), contentSize()));
|
||||
|
5
applet.h
5
applet.h
@ -729,6 +729,11 @@ class PLASMA_EXPORT Applet : public Widget
|
||||
*/
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
|
||||
/**
|
||||
* Reimplemented from QGraphicsItem
|
||||
*/
|
||||
void setSize(const QSizeF& size);
|
||||
|
||||
protected Q_SLOTS:
|
||||
/**
|
||||
* @internal used to show the configuration of an applet on first show
|
||||
|
@ -251,13 +251,6 @@ QRectF Widget::geometry() const
|
||||
return QRectF(pos(), d->size);
|
||||
}
|
||||
|
||||
#if 0
|
||||
QRectF Widget::localGeometry() const
|
||||
{
|
||||
return QRectF(QPointF(0.0f, 0.0f), boundingRect().size);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Widget::setGeometry(const QRectF& geometry)
|
||||
{
|
||||
if (geometry.size().width() > 0 && geometry.size().height() > 0 && d->size != geometry.size()) {
|
||||
@ -318,12 +311,6 @@ QFont Widget::font() const
|
||||
return QApplication::font();
|
||||
}
|
||||
|
||||
/*
|
||||
void Widget::setFont(const QFront& font)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
QRectF Widget::boundingRect() const
|
||||
{
|
||||
return QRectF(QPointF(0,0), d->size);
|
||||
@ -331,7 +318,6 @@ QRectF Widget::boundingRect() const
|
||||
|
||||
void Widget::resize(const QSizeF& size)
|
||||
{
|
||||
//FIXME: we need to respect minimum size here i think
|
||||
setGeometry(QRectF(pos(), size));
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ protected:
|
||||
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void setSize(qreal width, qreal height);
|
||||
void setSize(const QSizeF& size);
|
||||
virtual void setSize(const QSizeF& size);
|
||||
void managingLayoutChanged();
|
||||
|
||||
virtual bool sceneEvent(QEvent *event);
|
||||
|
Loading…
Reference in New Issue
Block a user