min/max setters and getters for content size

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=742754
This commit is contained in:
Aaron J. Seigo 2007-11-28 21:08:12 +00:00
parent 312f42dec0
commit f73b97780a
2 changed files with 55 additions and 3 deletions

View File

@ -907,13 +907,13 @@ Location Applet::location() const
QSizeF Applet::contentSize() const
{
int top , left , right , bottom;
d->getBorderSize(left,top,right,bottom);
int top, left, right, bottom;
d->getBorderSize(left, top, right, bottom);
// kDebug() << "Geometry size: " << geometry().size();
// kDebug() << "Borders: " << left << top << right << bottom;
return geometry().size() - QSizeF(left+right,top+bottom);
return geometry().size() - QSizeF(left + right, top + bottom);
}
QSizeF Applet::contentSizeHint() const
@ -925,6 +925,38 @@ QSizeF Applet::contentSizeHint() const
return contentSize();
}
void Applet::setMinimumContentSize(const QSizeF &minSize)
{
int top, left, right, bottom;
d->getBorderSize(left, top, right, bottom);
setMinimumSize(minSize + QSizeF(left + right, top + bottom));
}
QSizeF Applet::minimumContentSize() const
{
int top, left, right, bottom;
d->getBorderSize(left, top, right, bottom);
return minimumSize() - QSizeF(left + right, top + bottom);
}
void Applet::setMaximumContentSize(const QSizeF &maxSize)
{
int top, left, right, bottom;
d->getBorderSize(left, top, right, bottom);
setMaximumSize(maxSize + QSizeF(left + right, top + bottom));
}
QSizeF Applet::maximumContentSize() const
{
int top, left, right, bottom;
d->getBorderSize(left, top, right, bottom);
return maximumSize() - QSizeF(left + right, top + bottom);
}
QString Applet::globalName() const
{
if (!d->appletDescription.isValid()) {

View File

@ -234,6 +234,26 @@ class PLASMA_EXPORT Applet : public Widget
*/
virtual QSizeF contentSizeHint() const;
/**
* Sets the minimum size for the content of this applet
*/
void setMinimumContentSize(const QSizeF &minSize);
/**
* Get the minimum size for the content of this applet
*/
QSizeF minimumContentSize() const;
/**
* Sets the maximum size for the content of this applet.
*/
void setMaximumContentSize(const QSizeF &maxSize);
/**
* Get the minimum size for the content of this applet
*/
QSizeF maximumContentSize() const;
/**
* Returns a list of all known applets.
*