per applet aspect ratio guidance with setAspectRatioMode

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=759497
This commit is contained in:
Aaron J. Seigo 2008-01-10 19:02:05 +00:00
parent 45e31f3aee
commit 311f2380ce
2 changed files with 33 additions and 10 deletions

View File

@ -83,6 +83,7 @@ public:
cachedBackground(0),
mainConfig(0),
pendingConstraints(NoConstraint),
aspectRatioMode(Qt::KeepAspectRatio),
kioskImmutable(false),
immutable(false),
hasConfigurationInterface(false),
@ -401,6 +402,7 @@ public:
QPixmap* cachedBackground;
KConfigGroup *mainConfig;
Plasma::Constraints pendingConstraints;
Qt::AspectRatioMode aspectRatioMode;
bool kioskImmutable : 1;
bool immutable : 1;
bool hasConfigurationInterface : 1;
@ -1035,6 +1037,16 @@ QSizeF Applet::maximumContentSize() const
return maximumSize() - QSizeF(left + right, top + bottom);
}
Qt::AspectRatioMode Applet::aspectRatioMode() const
{
return d->aspectRatioMode;
}
void Applet::setAspectRatioMode(Qt::AspectRatioMode mode)
{
d->aspectRatioMode = mode;
}
QString Applet::globalName() const
{
if (!d->appletDescription.isValid()) {

View File

@ -59,16 +59,17 @@ class PLASMA_EXPORT Applet : public Widget
{
Q_OBJECT
// Q_PROPERTY( QRectF maxSizeHint READ maxSizeHint )
Q_PROPERTY( bool hasConfigurationInterface READ hasConfigurationInterface WRITE setHasConfigurationInterface )
Q_PROPERTY( QString name READ name )
Q_PROPERTY( QString category READ category )
Q_PROPERTY( bool immutable READ isImmutable WRITE setImmutable )
Q_PROPERTY( bool drawStandardBackground READ drawStandardBackground WRITE setDrawStandardBackground )
Q_PROPERTY( bool failedToLaunch READ failedToLaunch WRITE setFailedToLaunch )
Q_PROPERTY( bool needsConfiguring READ needsConfiguring WRITE setNeedsConfiguring )
Q_PROPERTY( QRectF boundingRect READ boundingRect )
Q_PROPERTY( QRectF geometry READ geometry WRITE setGeometry )
Q_PROPERTY( bool shouldConserveResources READ shouldConserveResources )
Q_PROPERTY(bool hasConfigurationInterface READ hasConfigurationInterface WRITE setHasConfigurationInterface)
Q_PROPERTY(QString name READ name)
Q_PROPERTY(QString category READ category)
Q_PROPERTY(bool immutable READ isImmutable WRITE setImmutable)
Q_PROPERTY(bool drawStandardBackground READ drawStandardBackground WRITE setDrawStandardBackground)
Q_PROPERTY(bool failedToLaunch READ failedToLaunch WRITE setFailedToLaunch)
Q_PROPERTY(bool needsConfiguring READ needsConfiguring WRITE setNeedsConfiguring)
Q_PROPERTY(QRectF boundingRect READ boundingRect)
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources)
Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
public:
typedef QList<Applet*> List;
@ -298,6 +299,16 @@ class PLASMA_EXPORT Applet : public Widget
*/
QSizeF maximumContentSize() const;
/**
* @return the prefered aspect ratio mode for placement and resizing
*/
Qt::AspectRatioMode aspectRatioMode() const;
/**
* @return the prefered aspect ratio mode for placement and resizing
*/
void setAspectRatioMode(Qt::AspectRatioMode);
/**
* Returns a list of all known applets.
*