Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 8

Qt-interest Archive, March 2002
QTabWidget Question (I want bigger tabs)


Message 1 in thread

Simple question:
How would one increase the size of the tabs in the QTabWidget?
We would like bigger tabs since we use a touchscreen.

I tought of overriding QTabWidget but then I saw it holds a QTabBar...
So I guess I need to derivate from QTabBar...

Can someone make this more obvious?

Maxime Asselin
Programmer-Analyst
Research and Development 


Message 2 in thread

Here is what I did with qtabwidget. My modifications (1) force the set
of tabs to take up the full available width and make them all equal
width, and (2) show the text label on the selected tab in a larger font.
Be warned that this code falls into the quick-and-dirty category. I'm
sure you can figure out how to make it do what you want from this
example.

In order to make this compile I had to do some ugly things, like change
some of the data in qtabbar.h to protected (from private). This is bad
OOP. While they made the paint function virtual, you can't seem to do
anything useful with it in a derived class since all the data members
you need are declared private. Thus the need to change the Qt header
file. Hopefully Trolltech will be more careful about declaring private
members in future versions, especially since you need to derive from
their classes quite often. If someone knows a way to get around this,
please tell me!

Sean Marble
AMET, Inc.
sean_m@ametinc.com

Attachment: tabpages.h
Description: Binary data

Attachment: tabpages.cpp
Description: Binary data