fix resizing in the panel.... again

svn path=/trunk/KDE/kdelibs/; revision=916933
This commit is contained in:
Marco Martin 2009-01-26 13:58:39 +00:00
parent 9ade53ab61
commit 0aefb02462
2 changed files with 11 additions and 21 deletions

View File

@ -118,7 +118,7 @@ NativeTabBar::NativeTabBar(QWidget *parent)
d->lastIndex[0] = -1;
connect(this, SIGNAL(currentChanged(int)), this, SLOT(startAnimation()));
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
}
NativeTabBar::~NativeTabBar()
@ -130,6 +130,12 @@ QRect NativeTabBar::tabRect(int index) const
{
QRect rect = KTabBar::tabRect(index).translated(d->left, d->top);
if (isVertical()) {
rect.setWidth(width()-d->top-d->bottom);
} else {
rect.setHeight(height()-d->top-d->bottom);
}
return rect;
}
@ -183,26 +189,10 @@ QSize NativeTabBar::tabSizeHint(int index) const
return hint;
}
//FIXME: this shouldn't be necessary but it seems to return wring numbers the base implementation?
QSize NativeTabBar::sizeHint() const
{
int width = 0;
int height = 0;
if (isVertical()) {
for (int i = count() - 1; i >= 0; i--) {
height += tabRect(i).height();
}
width = tabRect(0).width();
} else {
for (int i = count() - 1; i >= 0; i--) {
width += tabRect(i).width();
}
height = tabRect(0).height();
}
return QSize(width + d->left + d->right, height + d->top + d->bottom);
return KTabBar::sizeHint();
}
void NativeTabBar::paintEvent(QPaintEvent *event)

View File

@ -167,7 +167,7 @@ void TabBarPrivate::shapeChanged(const QTabBar::Shape shape)
default:
tabBarLayout->setOrientation(Qt::Horizontal);
tabWidgetLayout->setOrientation(Qt::Vertical);
tabWidgetLayout->itemAt(0)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
tabWidgetLayout->itemAt(0)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
tabWidgetLayout->itemAt(1)->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tabProxy->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
}
@ -271,7 +271,7 @@ int TabBar::currentIndex() const
void TabBar::resizeEvent(QGraphicsSceneResizeEvent * event)
{
if (!d->isTabWidget) {
d->tabProxy->native->setMinimumSize(event->newSize().toSize());
d->tabProxy->setMinimumSize(event->newSize().toSize());
} else {
d->tabProxy->native->setMinimumSize(QSize(0,0));
}