- boundingRect() now is pure virtual in Toolbox class
- correctly places the toolbox in vertical panels svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=799135
This commit is contained in:
parent
f27fb3fc1b
commit
b175042a04
@ -252,10 +252,12 @@ void Containment::containmentConstraintsUpdated(Plasma::Constraints constraints)
|
|||||||
//The placement assumes that the geometry width/height is no more than the screen
|
//The placement assumes that the geometry width/height is no more than the screen
|
||||||
if (d->type == PanelContainment) {
|
if (d->type == PanelContainment) {
|
||||||
if (formFactor() == Vertical) {
|
if (formFactor() == Vertical) {
|
||||||
d->toolbox->setPos(geometry().width()/2 - d->toolbox->boundingRect().width()/2, geometry().bottom());
|
d->toolbox->setOrientation(Qt::Vertical);
|
||||||
|
d->toolbox->setPos(geometry().width()/2 - d->toolbox->boundingRect().width()/2, geometry().height());
|
||||||
//defaulting to Horizontal right now
|
//defaulting to Horizontal right now
|
||||||
} else {
|
} else {
|
||||||
d->toolbox->setPos(geometry().right(), geometry().height()/2 - d->toolbox->boundingRect().height()/2);
|
d->toolbox->setOrientation(Qt::Horizontal);
|
||||||
|
d->toolbox->setPos(geometry().width(), geometry().height()/2 - d->toolbox->boundingRect().height()/2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
d->toolbox->setPos(geometry().right() - qAbs(d->toolbox->boundingRect().width()), 0);
|
d->toolbox->setPos(geometry().right() - qAbs(d->toolbox->boundingRect().width()), 0);
|
||||||
|
@ -98,6 +98,16 @@ DesktopToolbox::DesktopToolbox(QGraphicsItem *parent)
|
|||||||
d(new Private)
|
d(new Private)
|
||||||
{
|
{
|
||||||
connect(Plasma::Phase::self(), SIGNAL(movementComplete(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
connect(Plasma::Phase::self(), SIGNAL(movementComplete(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
||||||
|
|
||||||
|
setZValue(10000000);
|
||||||
|
setFlag(ItemClipsToShape, true);
|
||||||
|
setFlag(ItemClipsChildrenToShape, false);
|
||||||
|
setFlag(ItemIgnoresTransformations, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF DesktopToolbox::boundingRect() const
|
||||||
|
{
|
||||||
|
return QRectF(0, 0, -size()*2, size()*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void DesktopToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
@ -43,6 +43,7 @@ class DesktopToolbox : public Toolbox
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DesktopToolbox(QGraphicsItem *parent = 0);
|
explicit DesktopToolbox(QGraphicsItem *parent = 0);
|
||||||
|
QRectF boundingRect() const;
|
||||||
QPainterPath shape() const;
|
QPainterPath shape() const;
|
||||||
|
|
||||||
void showToolbox();
|
void showToolbox();
|
||||||
|
@ -97,6 +97,11 @@ PanelToolbox::PanelToolbox(QGraphicsItem *parent)
|
|||||||
d(new Private)
|
d(new Private)
|
||||||
{
|
{
|
||||||
connect(Plasma::Phase::self(), SIGNAL(movementComplete(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
connect(Plasma::Phase::self(), SIGNAL(movementComplete(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
||||||
|
|
||||||
|
setZValue(10000000);
|
||||||
|
setFlag(ItemClipsToShape, true);
|
||||||
|
setFlag(ItemClipsChildrenToShape, false);
|
||||||
|
setFlag(ItemIgnoresTransformations, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF PanelToolbox::boundingRect() const
|
QRectF PanelToolbox::boundingRect() const
|
||||||
|
@ -43,7 +43,7 @@ class PanelToolbox : public Toolbox
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PanelToolbox(QGraphicsItem *parent = 0);
|
explicit PanelToolbox(QGraphicsItem *parent = 0);
|
||||||
virtual QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
QPainterPath shape() const;
|
QPainterPath shape() const;
|
||||||
|
|
||||||
void showToolbox();
|
void showToolbox();
|
||||||
|
@ -59,15 +59,6 @@ Toolbox::Toolbox(QGraphicsItem *parent)
|
|||||||
d(new Private)
|
d(new Private)
|
||||||
{
|
{
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptsHoverEvents(true);
|
||||||
setZValue(10000000);
|
|
||||||
setFlag(ItemClipsToShape, true);
|
|
||||||
setFlag(ItemClipsChildrenToShape, false);
|
|
||||||
setFlag(ItemIgnoresTransformations, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF Toolbox::boundingRect() const
|
|
||||||
{
|
|
||||||
return QRectF(0, 0, -size()*2, size()*2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toolbox::addTool(QGraphicsItem *tool, const QString &name)
|
void Toolbox::addTool(QGraphicsItem *tool, const QString &name)
|
||||||
|
@ -38,7 +38,6 @@ class Toolbox : public QObject, public QGraphicsItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Toolbox(QGraphicsItem *parent = 0);
|
explicit Toolbox(QGraphicsItem *parent = 0);
|
||||||
virtual QRectF boundingRect() const;
|
|
||||||
|
|
||||||
void addTool(QGraphicsItem *tool, const QString &name);
|
void addTool(QGraphicsItem *tool, const QString &name);
|
||||||
void enableTool(const QString &tool, bool enabled);
|
void enableTool(const QString &tool, bool enabled);
|
||||||
|
Loading…
Reference in New Issue
Block a user