3
/* This file is heavily based upon part of the KDE libraries
4
Copyright (C) 2003 Stephan Binner <binner@kde.org>
5
Copyright (C) 2003 Zack Rusin <zack@kde.org>
11
#include <qtabwidget.h>
12
#include <qstringlist.h>
14
class KTabWidgetPrivate;
17
* \brief A widget containing multiple tabs
21
class KTabWidget : public QTabWidget
24
Q_PROPERTY( bool tabReorderingEnabled READ isTabReorderingEnabled WRITE setTabReorderingEnabled )
25
Q_PROPERTY( bool hoverCloseButton READ hoverCloseButton WRITE setHoverCloseButton )
26
Q_PROPERTY( bool hoverCloseButtonDelayed READ hoverCloseButtonDelayed WRITE setHoverCloseButtonDelayed )
27
Q_PROPERTY( bool tabCloseActivatePrevious READ tabCloseActivatePrevious WRITE setTabCloseActivatePrevious )
28
Q_PROPERTY( bool automaticResizeTabs READ automaticResizeTabs WRITE setAutomaticResizeTabs )
31
KTabWidget( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
35
virtual ~KTabWidget();
37
Set the tab of the given widget to \a color.
39
void setTabColor( QWidget *, const QColor& color );
40
QColor tabColor( QWidget * ) const;
43
Returns true if tab ordering with the middle mouse button
46
bool isTabReorderingEnabled() const;
49
Returns true if the close button is shown on tabs
50
when mouse is hovering over them.
52
bool hoverCloseButton() const;
55
Returns true if the close button is shown on tabs
58
bool hoverCloseButtonDelayed() const;
61
Returns true if closing the current tab activates the previous
62
actice tab instead of the one to the right.
65
bool tabCloseActivatePrevious() const;
68
Returns true if calling setTitle() will resize tabs
69
to the width of the tab bar.
72
bool automaticResizeTabs() const;
75
If \a hide is true, the tabbar is hidden along with any corner
79
void setTabBarHidden( bool hide );
82
Return true if the tabbar is hidden.
85
bool isTabBarHidden() const;
88
Sets the close icon used on the tabbar
91
void setCloseIcon(const QIconSet&);
94
Reimplemented for internal reasons.
96
virtual void insertTab( QWidget *, const QString &, int index = -1 );
99
Reimplemented for internal reasons.
101
virtual void insertTab( QWidget *child, const QIconSet& iconset,
102
const QString &label, int index = -1 );
104
Reimplemented for internal reasons.
106
virtual void insertTab( QWidget *, QTab *, int index = -1 );
109
Reimplemented for internal reasons.
111
void changeTab( QWidget *, const QString & );
114
Reimplemented for internal reasons.
116
void changeTab( QWidget *child, const QIconSet& iconset, const QString &label );
119
Reimplemented for internal reasons.
121
QString label( int ) const;
124
Reimplemented for internal reasons.
126
QString tabLabel( QWidget * ) const;
129
Reimplemented for internal reasons.
131
void setTabLabel( QWidget *, const QString & );
135
Move a widget's tab from first to second specified index and emit
136
signal movedTab( int, int ) afterwards.
138
virtual void moveTab( int, int );
141
Removes the widget, reimplemented for
142
internal reasons (keeping labels in sync).
144
virtual void removePage ( QWidget * w );
147
If \a enable is true, tab reordering with middle button will be enabled.
149
Note that once enabled you shouldn't rely on previously queried
150
currentPageIndex() or indexOf( QWidget * ) values anymore.
152
You can connect to signal movedTab(int, int) which will notify
153
you from which index to which index a tab has been moved.
155
void setTabReorderingEnabled( bool enable );
158
If \a enable is true, a close button will be shown on mouse hover
159
over tab icons which will emit signal closeRequest( QWidget * )
162
void setHoverCloseButton( bool enable );
165
If \a delayed is true, a close button will be shown on mouse hover
166
over tab icons after mouse double click delay else immediately.
168
void setHoverCloseButtonDelayed( bool delayed );
171
If \a delayed is true, closing the current tab activates the
172
previous active tab instead of the one to the right.
175
void setTabCloseActivatePrevious( bool previous );
178
If \a enable is true, tabs will be resized to the width of the tab bar.
180
Does not work reliable with "QTabWidget* foo=new KTabWidget()" and if
181
you change tabs via the tabbar or by accessing tabs directly.
184
void setAutomaticResizeTabs( bool enable );
188
Connect to this and set accept to true if you can and want to decode the event.
190
void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
193
Received an event in the empty space beside tabbar. Usually creates a new tab.
194
This signal is only possible after testCanDecode and positive accept result.
196
void receivedDropEvent( QDropEvent * );
199
Received an drop event on given widget's tab.
200
This signal is only possible after testCanDecode and positive accept result.
202
void receivedDropEvent( QWidget *, QDropEvent * );
205
Request to start a drag operation on the given tab.
207
void initiateDrag( QWidget * );
210
The right mouse button was pressed over empty space besides tabbar.
212
void contextMenu( const QPoint & );
215
The right mouse button was pressed over a widget.
217
void contextMenu( QWidget *, const QPoint & );
220
A tab was moved from first to second index. This signal is only
221
possible after you have called setTabReorderingEnabled( true ).
223
void movedTab( int, int );
226
A double left mouse button click was performed over empty space besides tabbar.
229
void mouseDoubleClick();
232
A double left mouse button click was performed over the widget.
234
void mouseDoubleClick( QWidget * );
237
A middle mouse button click was performed over empty space besides tabbar.
239
void mouseMiddleClick();
242
A middle mouse button click was performed over the widget.
244
void mouseMiddleClick( QWidget * );
247
The close button of a widget's tab was clicked. This signal is
248
only possible after you have called setHoverCloseButton( true ).
250
void closeRequest( QWidget * );
253
virtual void mouseDoubleClickEvent( QMouseEvent *e );
254
virtual void mousePressEvent( QMouseEvent * );
255
virtual void dragMoveEvent( QDragMoveEvent * );
256
virtual void dropEvent( QDropEvent * );
257
unsigned int tabBarWidthForMaxChars( uint maxLength );
258
#ifndef QT_NO_WHEELEVENT
259
virtual void wheelEvent( QWheelEvent *e );
261
virtual void resizeEvent( QResizeEvent * );
264
virtual void receivedDropEvent( int, QDropEvent * );
265
virtual void initiateDrag( int );
266
virtual void contextMenu( int, const QPoint & );
267
virtual void mouseDoubleClick( int );
268
virtual void mouseMiddleClick( int );
269
virtual void closeRequest( int );
270
#ifndef QT_NO_WHEELEVENT
271
virtual void wheelDelta( int );
275
bool isEmptyTabbarSpace( const QPoint & ) const;
276
void resizeTabs( int changedTabIndex = -1 );
277
void updateTab( int index );
278
KTabWidgetPrivate *d;