applets are no aware of their constraints. the simple solution is often the best one.
svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=670285
This commit is contained in:
parent
2c5f8a75bf
commit
7212ae5b5f
13
applet.cpp
13
applet.cpp
@ -28,6 +28,8 @@
|
||||
#include <KStandardDirs>
|
||||
#include <KService>
|
||||
#include <KServiceTypeTrader>
|
||||
|
||||
#include "corona.h"
|
||||
#include "dataenginemanager.h"
|
||||
|
||||
namespace Plasma
|
||||
@ -135,6 +137,17 @@ bool Applet::loadDataEngine( const QString& name )
|
||||
|
||||
void Applet::constraintsUpdated()
|
||||
{
|
||||
kDebug() << "constraints are FormFactor: " << formFactor() << ", Location: " << location() << endl;
|
||||
}
|
||||
|
||||
FormFactor Applet::formFactor() const
|
||||
{
|
||||
return static_cast<Corona*>(scene())->formFactor();
|
||||
}
|
||||
|
||||
Location Applet::location() const
|
||||
{
|
||||
return static_cast<Corona*>(scene())->location();
|
||||
}
|
||||
|
||||
QString Applet::globalName() const
|
||||
|
17
applet.h
17
applet.h
@ -98,10 +98,26 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup
|
||||
* called when any of the geometry constraints have been updated
|
||||
* this is always called prior to painting and should be used as an
|
||||
* opportunity to layout the widget, calculate sizings, etc.
|
||||
*
|
||||
* Do not call update() from this method; an update() will be triggered
|
||||
* at the appropriate time for the applet.
|
||||
*
|
||||
* @property constraint
|
||||
*/
|
||||
virtual void constraintsUpdated();
|
||||
|
||||
/**
|
||||
* Returns the current form factor the applet is being displayed in.
|
||||
* @see Plasma::FormFactor
|
||||
*/
|
||||
FormFactor formFactor() const;
|
||||
|
||||
/**
|
||||
* Returns the location of the scene which is displaying applet.
|
||||
* @see Plasma::Location
|
||||
*/
|
||||
Location location() const;
|
||||
|
||||
/**
|
||||
* Returns a list of all known applets in a hash keyed by a unique
|
||||
* identifier for each applet
|
||||
@ -109,6 +125,7 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup
|
||||
* @return list of applets
|
||||
**/
|
||||
static KPluginInfo::List knownApplets();
|
||||
|
||||
/**
|
||||
* Reimplement this slot to show a configuration dialog and let the user
|
||||
* play with the plasmoid options. Called when the user selects the configure entry
|
||||
|
@ -198,6 +198,7 @@ void Corona::addPlasmoid(const QString& name)
|
||||
Applet* applet = Applet::loadApplet(name);
|
||||
if (applet) {
|
||||
addItem(applet);
|
||||
//applet->constraintsUpdated();
|
||||
d->applets << applet;
|
||||
} else {
|
||||
kDebug() << "Plasmoid " << name << " could not be loaded." << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user