make the tabbar widget stretch also in height (thus umbreaking it in the

panel), with a dirty hack on minimum/maximum sizes, but i think it's the
only way for now, since minimumTabSizeHint() and maximumTabSizeHint()
are private in QTabBar and will be protected probably not before Qt5 O.o

svn path=/trunk/KDE/kdelibs/; revision=886098
This commit is contained in:
Marco Martin 2008-11-18 15:27:04 +00:00
parent 4f36ceb235
commit 9cfe6246ec
3 changed files with 21 additions and 1 deletions

View File

@ -248,7 +248,6 @@ void NativeTabBar::paintEvent(QPaintEvent *event)
// draw tab text
if (i == currentIndex() && d->animProgress == 1) {
//FIXME: theme will need a ButtonColor and ButtonTextColor
painter.setPen(Plasma::Theme::defaultTheme()->color(Theme::ButtonTextColor));
} else {
QColor color(Plasma::Theme::defaultTheme()->color(Theme::TextColor));
@ -394,6 +393,14 @@ QSize NativeTabBar::tabSize(int index) const
hint.rheight() = qMax(iconSize().height(), textSize.height());
hint.rwidth() += d->buttonLeft + d->buttonRight;
hint.rheight() += d->buttonTop + d->buttonBottom;
//FIXME: this margin calculation isn't reeeally right...
if (isVertical()) {
hint.rwidth() = qMax(hint.width(), int(minimumWidth() - d->left - d->right - d->buttonLeft - d->buttonRight));
} else {
hint.rheight() = qMax(hint.height(), int(minimumHeight() - d->top - d->bottom - d->buttonTop - d->buttonBottom));
}
return hint;
}

View File

@ -268,6 +268,18 @@ int TabBar::currentIndex() const
return d->tabProxy->native->currentIndex();
}
void TabBar::resizeEvent(QGraphicsSceneResizeEvent * event)
{
if (!d->isTabWidget) {
d->tabProxy->native->setMinimumSize(contentsRect().size().toSize());
} else {
d->tabProxy->native->setMinimumSize(QSize(0,0));
}
setMaximumSize(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX);
setMinimumSize(0, 0);
}
void TabBar::setCurrentIndex(int index)
{
if (index > d->tabProxy->native->count() || d->tabProxy->native->count() <= 1) {

View File

@ -192,6 +192,7 @@ Q_SIGNALS:
protected:
void wheelEvent(QGraphicsSceneWheelEvent *event);
void resizeEvent(QGraphicsSceneResizeEvent * event);
private:
TabBarPrivate * const d;