ensure the toolbox fits in the panel; makes small panels work better
svn path=/trunk/KDE/kdelibs/; revision=882654
This commit is contained in:
parent
aec4445dec
commit
0eb079d33b
@ -118,14 +118,30 @@ PanelToolBox::~PanelToolBox()
|
||||
|
||||
QRectF PanelToolBox::boundingRect() const
|
||||
{
|
||||
QRectF r;
|
||||
|
||||
if (corner() == ToolBox::Bottom) {
|
||||
return QRectF(0, 0, size() * 2, -size());
|
||||
r = QRectF(0, 0, size() * 2, -size());
|
||||
} else if (corner() == ToolBox::Left) {
|
||||
return QRectF(0, 0, size(), size() * 2);
|
||||
r = QRectF(0, 0, size(), size() * 2);
|
||||
//Only Left,Right and Bottom supported, default to Right
|
||||
} else {
|
||||
return QRectF(0, 0, -size(), size() * 2);
|
||||
r = QRectF(0, 0, -size(), size() * 2);
|
||||
}
|
||||
|
||||
if (parentItem()) {
|
||||
QSizeF s = parentItem()->boundingRect().size();
|
||||
|
||||
if (r.height() > s.height()) {
|
||||
r.setHeight(s.height());
|
||||
}
|
||||
|
||||
if (r.width() > s.width()) {
|
||||
r.setWidth(s.width());
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void PanelToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
|
Loading…
Reference in New Issue
Block a user