KDEUI
ktabwidget.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2003 Stephan Binner <binner@kde.org> 00003 Copyright (C) 2003 Zack Rusin <zack@kde.org> 00004 Copyright (C) 2009 Urs Wolfer <uwolfer @ kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KTABWIDGET_H 00023 #define KTABWIDGET_H 00024 00025 #include <kdeui_export.h> 00026 00027 #include <QtGui/QTabWidget> 00028 00029 class QTab; 00030 00044 class KDEUI_EXPORT KTabWidget : public QTabWidget //krazy:exclude=qclasses 00045 { 00046 Q_OBJECT 00047 #ifndef KDE_NO_DEPRECATED 00048 Q_PROPERTY( bool tabReorderingEnabled READ isTabReorderingEnabled WRITE setTabReorderingEnabled ) 00049 Q_PROPERTY( bool hoverCloseButton READ hoverCloseButton WRITE setHoverCloseButton ) 00050 Q_PROPERTY( bool hoverCloseButtonDelayed READ hoverCloseButtonDelayed WRITE setHoverCloseButtonDelayed ) 00051 Q_PROPERTY( bool closeButtonEnabled READ isCloseButtonEnabled WRITE setCloseButtonEnabled ) 00052 Q_PROPERTY( bool tabCloseActivatePrevious READ tabCloseActivatePrevious WRITE setTabCloseActivatePrevious ) 00053 #endif 00054 Q_PROPERTY( bool automaticResizeTabs READ automaticResizeTabs WRITE setAutomaticResizeTabs ) 00055 00056 public: 00057 00064 explicit KTabWidget( QWidget *parent = 0, Qt::WFlags flags = 0 ); 00065 00069 virtual ~KTabWidget(); 00070 00075 void setTabTextColor( int index, const QColor& color ); 00076 00081 QColor tabTextColor( int index ) const; 00082 00089 bool isTabReorderingEnabled() const; 00090 00097 #ifndef KDE_NO_DEPRECATED 00098 KDE_DEPRECATED bool hoverCloseButton() const; 00099 #endif 00100 00107 #ifndef KDE_NO_DEPRECATED 00108 KDE_DEPRECATED bool hoverCloseButtonDelayed() const; 00109 #endif 00110 00118 #ifndef KDE_NO_DEPRECATED 00119 KDE_DEPRECATED bool isCloseButtonEnabled() const; 00120 #endif 00121 00128 #ifndef KDE_NO_DEPRECATED 00129 KDE_DEPRECATED bool tabCloseActivatePrevious() const; 00130 #endif 00131 00136 bool automaticResizeTabs() const; 00137 00142 void setTabBarHidden( bool hide ); 00143 00149 bool isTabBarHidden() const; 00150 00169 QString tabText( int ) const; // but it's not virtual... 00170 00171 #ifdef KDE3_SUPPORT 00172 00175 #ifndef KDE_NO_DEPRECATED 00176 inline KDE_DEPRECATED QString label( int index ) const { return tabText( index ); } 00177 #endif 00178 00182 #ifndef KDE_NO_DEPRECATED 00183 inline KDE_DEPRECATED QString tabLabel( QWidget *w ) const { return tabText( indexOf( w ) ); } 00184 #endif 00185 00189 #ifndef KDE_NO_DEPRECATED 00190 inline KDE_DEPRECATED void setTabLabel( QWidget *w, const QString &l ) { setTabText( indexOf( w ),l ); } 00191 #endif 00192 #endif 00193 00197 void setTabText( int , const QString & ); 00198 00199 using QTabWidget::tabBar; 00200 00201 public Q_SLOTS: 00206 virtual void moveTab( int, int ); 00207 00213 virtual QT_MOC_COMPAT void removePage ( QWidget * w ); 00214 00219 virtual void removeTab(int index); // but it's not virtual in QTabWidget... 00220 00236 #ifndef KDE_NO_DEPRECATED 00237 QT_MOC_COMPAT void setTabReorderingEnabled( bool enable ); 00238 #endif 00239 00247 #ifndef KDE_NO_DEPRECATED 00248 QT_MOC_COMPAT void setHoverCloseButton( bool enable ); 00249 #endif 00250 00257 #ifndef KDE_NO_DEPRECATED 00258 QT_MOC_COMPAT void setHoverCloseButtonDelayed( bool delayed ); 00259 #endif 00260 00270 #ifndef KDE_NO_DEPRECATED 00271 QT_MOC_COMPAT void setCloseButtonEnabled( bool ); 00272 #endif 00273 00280 #ifndef KDE_NO_DEPRECATED 00281 QT_MOC_COMPAT void setTabCloseActivatePrevious( bool previous ); 00282 #endif 00283 00290 void setAutomaticResizeTabs( bool enable ); 00291 00292 Q_SIGNALS: 00296 void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */); 00297 00302 void receivedDropEvent( QDropEvent * ); 00303 00308 void receivedDropEvent( QWidget *, QDropEvent * ); 00309 00313 void initiateDrag( QWidget * ); 00314 00318 void contextMenu( const QPoint & ); 00319 00323 void contextMenu( QWidget *, const QPoint & ); 00324 00329 void movedTab( int, int ); 00330 00335 void mouseDoubleClick(); 00336 00341 void mouseDoubleClick( QWidget * ); 00342 00347 void mouseMiddleClick(); 00348 00353 void mouseMiddleClick( QWidget * ); 00354 00359 void closeRequest( QWidget * ); 00360 00361 protected: 00362 virtual void mouseDoubleClickEvent( QMouseEvent* ); 00363 virtual void mousePressEvent( QMouseEvent* ); 00364 virtual void mouseReleaseEvent( QMouseEvent* ); 00365 virtual void dragEnterEvent( QDragEnterEvent* ); 00366 virtual void dragMoveEvent( QDragMoveEvent* ); 00367 virtual void dropEvent( QDropEvent* ); 00368 int tabBarWidthForMaxChars( int ); 00369 #ifndef QT_NO_WHEELEVENT 00370 virtual void wheelEvent( QWheelEvent* ); 00371 #endif 00372 virtual void resizeEvent( QResizeEvent* ); 00373 virtual void tabInserted( int ); 00374 virtual void tabRemoved ( int ); 00375 00379 #ifndef KDE_NO_DEPRECATED 00380 KDE_DEPRECATED void currentChanged( int ); 00381 #endif 00382 00383 protected Q_SLOTS: 00384 virtual void receivedDropEvent( int, QDropEvent* ); 00385 virtual void initiateDrag( int ); 00386 virtual void contextMenu( int, const QPoint& ); 00387 virtual void mouseDoubleClick( int ); 00388 virtual void mouseMiddleClick( int ); 00389 virtual void closeRequest( int ); 00390 #ifndef QT_NO_WHEELEVENT 00391 virtual void wheelDelta( int ); 00392 #endif 00393 00394 private: 00395 class Private; 00396 Private * const d; 00397 }; 00398 00399 #endif
KDE 4.6 API Reference