kdeui
ktabwidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KTABWIDGET_H
00022 #define KTABWIDGET_H
00023
00024 #include <qtabwidget.h>
00025 #include <qstringlist.h>
00026
00027 #include <kdelibs_export.h>
00028
00029 class KTabWidgetPrivate;
00030
00036 class KDEUI_EXPORT KTabWidget : public QTabWidget
00037 {
00038 Q_OBJECT
00039 Q_PROPERTY( bool tabReorderingEnabled READ isTabReorderingEnabled WRITE setTabReorderingEnabled )
00040 Q_PROPERTY( bool hoverCloseButton READ hoverCloseButton WRITE setHoverCloseButton )
00041 Q_PROPERTY( bool hoverCloseButtonDelayed READ hoverCloseButtonDelayed WRITE setHoverCloseButtonDelayed )
00042 Q_PROPERTY( bool tabCloseActivatePrevious READ tabCloseActivatePrevious WRITE setTabCloseActivatePrevious )
00043 Q_PROPERTY( bool automaticResizeTabs READ automaticResizeTabs WRITE setAutomaticResizeTabs )
00044
00045 public:
00046 KTabWidget( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
00050 virtual ~KTabWidget();
00054 void setTabColor( QWidget *, const QColor& color );
00058 QColor tabColor( QWidget * ) const;
00059
00064 bool isTabReorderingEnabled() const;
00065
00070 bool hoverCloseButton() const;
00071
00076 bool hoverCloseButtonDelayed() const;
00077
00083 bool tabCloseActivatePrevious() const;
00084
00090 bool automaticResizeTabs() const;
00091
00097 void setTabBarHidden( bool hide );
00098
00103 bool isTabBarHidden() const;
00104
00108 virtual void insertTab( QWidget *, const QString &, int index = -1 );
00109
00113 virtual void insertTab( QWidget *child, const QIconSet& iconset,
00114 const QString &label, int index = -1 );
00118 virtual void insertTab( QWidget *, QTab *, int index = -1 );
00119
00123 void changeTab( QWidget *, const QString & );
00124
00128 void changeTab( QWidget *child, const QIconSet& iconset, const QString &label );
00129
00133 QString label( int ) const;
00134
00138 QString tabLabel( QWidget * ) const;
00139
00143 void setTabLabel( QWidget *, const QString & );
00144
00145 public slots:
00150 virtual void moveTab( int, int );
00151
00156 virtual void removePage ( QWidget * w );
00157
00167 void setTabReorderingEnabled( bool enable );
00168
00174 void setHoverCloseButton( bool enable );
00175
00180 void setHoverCloseButtonDelayed( bool delayed );
00181
00187 void setTabCloseActivatePrevious( bool previous );
00188
00196 void setAutomaticResizeTabs( bool enable );
00197
00198 signals:
00202 void testCanDecode(const QDragMoveEvent *e, bool &accept );
00203
00208 void receivedDropEvent( QDropEvent * );
00209
00214 void receivedDropEvent( QWidget *, QDropEvent * );
00215
00219 void initiateDrag( QWidget * );
00220
00224 void contextMenu( const QPoint & );
00225
00229 void contextMenu( QWidget *, const QPoint & );
00230
00235 void movedTab( int, int );
00236
00241 void mouseDoubleClick();
00242
00246 void mouseDoubleClick( QWidget * );
00247
00251 void mouseMiddleClick();
00252
00256 void mouseMiddleClick( QWidget * );
00257
00262 void closeRequest( QWidget * );
00263
00264 protected:
00265 virtual void mouseDoubleClickEvent( QMouseEvent *e );
00266 virtual void mousePressEvent( QMouseEvent * );
00267 virtual void dragMoveEvent( QDragMoveEvent * );
00268 virtual void dropEvent( QDropEvent * );
00269 unsigned int tabBarWidthForMaxChars( uint maxLength );
00270 #ifndef QT_NO_WHEELEVENT
00271 virtual void wheelEvent( QWheelEvent *e );
00272 #endif
00273 virtual void resizeEvent( QResizeEvent * );
00274
00275 protected slots:
00276 virtual void receivedDropEvent( int, QDropEvent * );
00277 virtual void initiateDrag( int );
00278 virtual void contextMenu( int, const QPoint & );
00279 virtual void mouseDoubleClick( int );
00280 virtual void mouseMiddleClick( int );
00281 virtual void closeRequest( int );
00282 #ifndef QT_NO_WHEELEVENT
00283 virtual void wheelDelta( int );
00284 #endif
00285
00286 private:
00287 bool isEmptyTabbarSpace( const QPoint & ) const;
00288 void resizeTabs( int changedTabIndex = -1 );
00289 void updateTab( int index );
00290
00291 KTabWidgetPrivate *d;
00292 };
00293
00294 #endif