Ammmaaziiing grace!!
Widget class is dead.. still in the repo for tooltip code CCMAIL : aseigo@kde.org svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=796973
This commit is contained in:
parent
fd37ae89b0
commit
d5dd4e16ac
@ -59,7 +59,6 @@ set(plasma_LIB_SRCS
|
|||||||
scripting/runnerscript.cpp
|
scripting/runnerscript.cpp
|
||||||
scripting/scriptengine.cpp
|
scripting/scriptengine.cpp
|
||||||
widgets/icon.cpp
|
widgets/icon.cpp
|
||||||
widgets/widget.cpp
|
|
||||||
widgets/webcontent.cpp
|
widgets/webcontent.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -136,7 +135,6 @@ install(FILES
|
|||||||
install(FILES
|
install(FILES
|
||||||
widgets/icon.h
|
widgets/icon.h
|
||||||
widgets/webcontent.h
|
widgets/webcontent.h
|
||||||
widgets/widget.h
|
|
||||||
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/widgets)
|
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/widgets)
|
||||||
|
|
||||||
#For future
|
#For future
|
||||||
|
25
applet.cpp
25
applet.cpp
@ -39,6 +39,7 @@
|
|||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsLinearLayout>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsProxyWidget>
|
#include <QGraphicsProxyWidget>
|
||||||
|
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
@ -68,23 +69,21 @@
|
|||||||
#include "plasma/theme.h"
|
#include "plasma/theme.h"
|
||||||
#include "plasma/view.h"
|
#include "plasma/view.h"
|
||||||
|
|
||||||
#include "plasma/widgets/widget.h"
|
|
||||||
|
|
||||||
//#define DYNAMIC_SHADOWS
|
//#define DYNAMIC_SHADOWS
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
class OverlayWidget : public Widget
|
class OverlayWidget : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OverlayWidget(Widget *parent)
|
OverlayWidget(QGraphicsWidget *parent)
|
||||||
: Widget(parent, parent)
|
: QGraphicsWidget(parent)
|
||||||
{
|
{
|
||||||
resize(parent->size());
|
resize(parent->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
|
||||||
{
|
{
|
||||||
Q_UNUSED(option)
|
Q_UNUSED(option)
|
||||||
Q_UNUSED(widget)
|
Q_UNUSED(widget)
|
||||||
@ -92,7 +91,7 @@ protected:
|
|||||||
painter->setRenderHint(QPainter::Antialiasing);
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
QColor wash = Plasma::Theme::self()->backgroundColor();
|
QColor wash = Plasma::Theme::self()->backgroundColor();
|
||||||
wash.setAlphaF(.6);
|
wash.setAlphaF(.6);
|
||||||
painter->fillPath(parent()->shape(), wash);
|
painter->fillPath(parentItem()->shape(), wash);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -334,7 +333,7 @@ PackageStructure::Ptr Applet::Private::packageStructure(0);
|
|||||||
Applet::Applet(QGraphicsItem *parent,
|
Applet::Applet(QGraphicsItem *parent,
|
||||||
const QString& serviceID,
|
const QString& serviceID,
|
||||||
uint appletId)
|
uint appletId)
|
||||||
: Widget(parent),
|
: QGraphicsWidget(parent),
|
||||||
d(new Private(KService::serviceByStorageId(serviceID), appletId))
|
d(new Private(KService::serviceByStorageId(serviceID), appletId))
|
||||||
{
|
{
|
||||||
// WARNING: do not access config() OR globalConfig() in this method!
|
// WARNING: do not access config() OR globalConfig() in this method!
|
||||||
@ -343,7 +342,7 @@ Applet::Applet(QGraphicsItem *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Applet::Applet(QObject* parentObject, const QVariantList& args)
|
Applet::Applet(QObject* parentObject, const QVariantList& args)
|
||||||
: Widget(0,parentObject),
|
: QGraphicsWidget(0),
|
||||||
d(new Private(KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString()),
|
d(new Private(KService::serviceByStorageId(args.count() > 0 ? args[0].toString() : QString()),
|
||||||
args.count() > 1 ? args[1].toInt() : 0))
|
args.count() > 1 ? args[1].toInt() : 0))
|
||||||
{
|
{
|
||||||
@ -943,7 +942,7 @@ int Applet::type() const
|
|||||||
QPainterPath Applet::shape() const
|
QPainterPath Applet::shape() const
|
||||||
{
|
{
|
||||||
if (isContainment()) {
|
if (isContainment()) {
|
||||||
return Plasma::Widget::shape();
|
return QGraphicsWidget::shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Plasma::roundedRectangle(boundingRect().adjusted(-2, -2, 2, 2), 10);
|
return Plasma::roundedRectangle(boundingRect().adjusted(-2, -2, 2, 2), 10);
|
||||||
@ -1495,13 +1494,13 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Widget::itemChange(change, value);
|
return QGraphicsWidget::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::setGeometry(const QRectF& geometry)
|
void Applet::setGeometry(const QRectF& geometry)
|
||||||
{
|
{
|
||||||
QRectF beforeGeom = Widget::geometry();
|
QRectF beforeGeom = QGraphicsWidget::geometry();
|
||||||
Widget::setGeometry(geometry);
|
QGraphicsWidget::setGeometry(geometry);
|
||||||
if (geometry.size() != beforeGeom.size())
|
if (geometry.size() != beforeGeom.size())
|
||||||
{
|
{
|
||||||
updateConstraints(Plasma::SizeConstraint);
|
updateConstraints(Plasma::SizeConstraint);
|
||||||
|
7
applet.h
7
applet.h
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <QtGui/QGraphicsItem>
|
#include <QtGui/QGraphicsItem>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
#include <QtGui/QGraphicsWidget>
|
||||||
|
|
||||||
#include <KDE/KPluginInfo>
|
#include <KDE/KPluginInfo>
|
||||||
#include <KDE/KGenericFactory>
|
#include <KDE/KGenericFactory>
|
||||||
@ -31,9 +32,9 @@
|
|||||||
#include <plasma/configxml.h>
|
#include <plasma/configxml.h>
|
||||||
#include <plasma/packagestructure.h>
|
#include <plasma/packagestructure.h>
|
||||||
#include <plasma/plasma.h>
|
#include <plasma/plasma.h>
|
||||||
#include <plasma/widgets/widget.h>
|
|
||||||
|
|
||||||
class KConfigDialog;
|
class KConfigDialog;
|
||||||
|
class QGraphicsView;
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -58,10 +59,9 @@ class Package;
|
|||||||
*
|
*
|
||||||
* See techbase.kde.org for tutorial on writing Applets using this class.
|
* See techbase.kde.org for tutorial on writing Applets using this class.
|
||||||
*/
|
*/
|
||||||
class PLASMA_EXPORT Applet : public Widget
|
class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// Q_PROPERTY( QRectF maxSizeHint READ maxSizeHint )
|
|
||||||
Q_PROPERTY(bool hasConfigurationInterface READ hasConfigurationInterface WRITE setHasConfigurationInterface)
|
Q_PROPERTY(bool hasConfigurationInterface READ hasConfigurationInterface WRITE setHasConfigurationInterface)
|
||||||
Q_PROPERTY(QString name READ name)
|
Q_PROPERTY(QString name READ name)
|
||||||
Q_PROPERTY(QString category READ category)
|
Q_PROPERTY(QString category READ category)
|
||||||
@ -69,7 +69,6 @@ class PLASMA_EXPORT Applet : public Widget
|
|||||||
Q_PROPERTY(bool drawStandardBackground READ drawStandardBackground WRITE setDrawStandardBackground)
|
Q_PROPERTY(bool drawStandardBackground READ drawStandardBackground WRITE setDrawStandardBackground)
|
||||||
Q_PROPERTY(bool failedToLaunch READ failedToLaunch WRITE setFailedToLaunch)
|
Q_PROPERTY(bool failedToLaunch READ failedToLaunch WRITE setFailedToLaunch)
|
||||||
Q_PROPERTY(bool needsConfiguring READ needsConfiguring WRITE setNeedsConfiguring)
|
Q_PROPERTY(bool needsConfiguring READ needsConfiguring WRITE setNeedsConfiguring)
|
||||||
Q_PROPERTY(QRectF boundingRect READ boundingRect)
|
|
||||||
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
|
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
|
||||||
Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources)
|
Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources)
|
||||||
Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
|
Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
|
||||||
|
@ -651,14 +651,14 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
|||||||
applet->removeSceneEventFilter(currentContainment);
|
applet->removeSceneEventFilter(currentContainment);
|
||||||
KConfigGroup oldConfig = applet->config();
|
KConfigGroup oldConfig = applet->config();
|
||||||
currentContainment->d->applets.removeAll(applet);
|
currentContainment->d->applets.removeAll(applet);
|
||||||
addChild(applet);
|
applet->setParentItem(this);
|
||||||
|
|
||||||
// now move the old config to the new location
|
// now move the old config to the new location
|
||||||
KConfigGroup c = config().group("Applets").group(QString::number(applet->id()));
|
KConfigGroup c = config().group("Applets").group(QString::number(applet->id()));
|
||||||
oldConfig.reparent(&c);
|
oldConfig.reparent(&c);
|
||||||
applet->resetConfigurationObject();
|
applet->resetConfigurationObject();
|
||||||
} else {
|
} else {
|
||||||
addChild(applet);
|
applet->setParentItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->applets << applet;
|
d->applets << applet;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
|
||||||
#include "widgets/widget.h"
|
#include <plasma/applet.h>
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -300,7 +300,7 @@ void PanelToolbox::toolMoved(QGraphicsItem *item)
|
|||||||
{
|
{
|
||||||
//kDebug() << "geometry is now " << static_cast<Plasma::Widget*>(item)->geometry();
|
//kDebug() << "geometry is now " << static_cast<Plasma::Widget*>(item)->geometry();
|
||||||
if (!showing() &&
|
if (!showing() &&
|
||||||
QGraphicsItem::children().indexOf(static_cast<Plasma::Widget*>(item)) != -1) {
|
QGraphicsItem::children().indexOf(static_cast<Plasma::Applet*>(item)) != -1) {
|
||||||
item->hide();
|
item->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
|
||||||
#include "widgets/widget.h"
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -86,11 +86,6 @@ Widget::Widget(QGraphicsItem *parent, QObject* parentObject)
|
|||||||
{
|
{
|
||||||
setFlag(QGraphicsItem::ItemClipsToShape, true);
|
setFlag(QGraphicsItem::ItemClipsToShape, true);
|
||||||
setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
|
setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
|
||||||
|
|
||||||
Widget *w = dynamic_cast<Widget *>(parent);
|
|
||||||
if (w) {
|
|
||||||
w->addChild(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
@ -103,49 +98,6 @@ Widget::~Widget()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget *Widget::parent() const
|
|
||||||
{
|
|
||||||
return parent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget *Widget::parent(const QGraphicsItem *item)
|
|
||||||
{
|
|
||||||
Q_ASSERT(item);
|
|
||||||
QGraphicsItem *parent = item->parentItem();
|
|
||||||
|
|
||||||
while (parent) {
|
|
||||||
Widget *parentWidget = dynamic_cast<Widget *>(parent);
|
|
||||||
|
|
||||||
if (parentWidget) {
|
|
||||||
return parentWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent = parent->parentItem();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::addChild(Widget *w)
|
|
||||||
{
|
|
||||||
if (!w || QGraphicsItem::children().contains(w)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
w->setParentItem(this);
|
|
||||||
|
|
||||||
//kDebug() << "Added Child Widget" << (QObject*)w << "our geom is" << geometry();
|
|
||||||
QGraphicsLinearLayout * lay = dynamic_cast<QGraphicsLinearLayout *>(layout());
|
|
||||||
if (lay) {
|
|
||||||
lay->addItem(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateGeometry();
|
|
||||||
//kDebug() << "after the item is added our geom is now" << geometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TOOLTIPMANAGER
|
#ifdef TOOLTIPMANAGER
|
||||||
const ToolTipData* Widget::toolTip() const
|
const ToolTipData* Widget::toolTip() const
|
||||||
|
@ -77,22 +77,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual ~Widget();
|
virtual ~Widget();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return this Plasma::Widget's parent, returns a null pointer if
|
|
||||||
* none exist.
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE Widget *parent() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the Plasma::Widget parent for a given QGraphicsItem
|
|
||||||
*/
|
|
||||||
static Widget *parent(const QGraphicsItem *item);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add another Plasma::Widget as a child of this one.
|
|
||||||
* @param widget the widget to reparent to this Plasma::Widget.
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void addChild(Widget *widget);
|
|
||||||
|
|
||||||
#ifdef TOOLTIPMANAGER
|
#ifdef TOOLTIPMANAGER
|
||||||
/**
|
/**
|
||||||
@ -124,7 +108,6 @@ protected:
|
|||||||
virtual bool sceneEvent(QEvent *event);
|
virtual bool sceneEvent(QEvent *event);
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
Private *const d;
|
Private *const d;
|
||||||
|
Loading…
Reference in New Issue
Block a user