* get rid of the paintHover, that's deprecated by kevin's hover stuff in the coronal world

* don't paint the interface of containments being shown on views that don't want a background

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=737026
This commit is contained in:
Aaron J. Seigo 2007-11-15 09:39:46 +00:00
parent 206b07ece1
commit bfcc1e31e6
2 changed files with 35 additions and 10 deletions

View File

@ -55,6 +55,7 @@
#include "plasma/shadowitem_p.h" #include "plasma/shadowitem_p.h"
#include "plasma/svg.h" #include "plasma/svg.h"
#include "plasma/theme.h" #include "plasma/theme.h"
#include "plasma/view.h"
#include "plasma/widgets/widget.h" #include "plasma/widgets/widget.h"
#include "plasma/widgets/lineedit.h" #include "plasma/widgets/lineedit.h"
@ -85,7 +86,8 @@ public:
immutable(false), immutable(false),
hasConfigurationInterface(false), hasConfigurationInterface(false),
failed(false), failed(false),
needsConfig(false) needsConfig(false),
isContainment(false)
{ {
if (appletId == 0) { if (appletId == 0) {
appletId = nextId(); appletId = nextId();
@ -282,11 +284,6 @@ public:
p2->drawPixmap(leftOffset, topOffset, *cachedBackground); p2->drawPixmap(leftOffset, topOffset, *cachedBackground);
} }
void paintHover(QPainter* , Applet* )
{
//TODO draw hover interface for close, configure, info and move
}
QSizeF contentSize(const Applet* q) QSizeF contentSize(const Applet* q)
{ {
if (scriptEngine) { if (scriptEngine) {
@ -369,6 +366,7 @@ public:
bool hasConfigurationInterface : 1; bool hasConfigurationInterface : 1;
bool failed : 1; bool failed : 1;
bool needsConfig : 1; bool needsConfig : 1;
bool isContainment : 1;
}; };
uint Applet::Private::s_maxAppletId = 0; uint Applet::Private::s_maxAppletId = 0;
@ -798,10 +796,17 @@ void Applet::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *opti
} }
if (!d->failed && !d->needsConfig) { if (!d->failed && !d->needsConfig) {
if (widget && isContainment()) {
// note that the widget we get is actually the viewport of the view, not the view itself
View* v = qobject_cast<Plasma::View*>(widget->parent());
if (v && !v->drawWallpaper()) {
return;
}
}
paintInterface(painter, option, QRect(QPoint(0,0), d->contentSize(this).toSize())); paintInterface(painter, option, QRect(QPoint(0,0), d->contentSize(this).toSize()));
} }
d->paintHover(painter, this);
/*} else if (fabs(zoomLevel - scalingFactor(Plasma::GroupZoom)) < std::numeric_limits<double>::epsilon()) { /*} else if (fabs(zoomLevel - scalingFactor(Plasma::GroupZoom)) < std::numeric_limits<double>::epsilon()) {
// Show Groups + Applet outline // Show Groups + Applet outline
//TODO: make pretty. //TODO: make pretty.
@ -1163,6 +1168,16 @@ void Applet::setGeometry(const QRectF& geometry)
update(); update();
} }
void Applet::setIsContainment(bool isContainment)
{
d->isContainment = isContainment;
}
bool Applet::isContainment() const
{
return d->isContainment;
}
void Applet::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void Applet::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{ {
//kDebug() << "context menu event!"; //kDebug() << "context menu event!";

View File

@ -473,6 +473,16 @@ class PLASMA_EXPORT Applet : public Widget
*/ */
void setGeometry(const QRectF &geometry); void setGeometry(const QRectF &geometry);
/**
* Sets whether or not this Applet is acting as a Containment
*/
void setIsContainment(bool isContainment);
/**
* @return true if this Applet is currently being used as a Containment, false otherwise
*/
bool isContainment() const;
Q_SIGNALS: Q_SIGNALS:
/** /**
* Emitted when the applet needs to take (or lose) keyboard focus. * Emitted when the applet needs to take (or lose) keyboard focus.