PDA

View Full Version : tabSizeHint?



nikita
7th September 2006, 13:05
i'm trying to change the size of the tab in a QTabBar, however this does nothing:

class tbA: public QTabBar
{
public:
tbA(QWidget *p=0) : QTabBar(p)
{
for (int i = 0; i < tbA::count(); ++i)
tbA::tabSizeHint(i).setWidth(15);

}
};

am i missing something? thanks.

jacek
7th September 2006, 13:34
I guess that count() == 0.

jpn
7th September 2006, 13:41
And it doesn't work that way anyway.

You cannot set the hints like that, you should override QTabBar::tabSizeHint() (http://doc.trolltech.com/4.1/qtabbar#tabSizeHint).


class tbA: public QTabBar
{
...
protected:
QSize tabSizeHint(int index) const;
...
};

QSize tbA::tabSizeHint(int index) const
{
return QSize(...);
}