tags:

views:

1733

answers:

2

I'm using a QTabWidget to render multiple documents in a window, and I want to draw a close button on each tab. I'm using Vista and Qt4, so the tab widget is a native windows control; this may affect the feasibility.

Does anyone know if it is possible to do this using the QTabWidget control, or do I have to create a custom widget? If creating a new widget is the only option, any pointers would be much appreciated; I'm relatively new to Qt.

+2  A: 

Currently there is no way to do this with the stock QTabWidget, however the upcoming Qt 4.5 (planned to be released in March 2009) will have the ability to add close buttons to tabs either manually or by setting a QTabBar.TabsClosable property.

Until then, the only way to get close buttons is to subclass QTabWidget or QTabBar and add it manually (possible, but not trivial).

dF
+2  A: 

In 4.5 there is function

void setTabsClosable ( bool closeable )
Pavels