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 #ifndef KDE_NO_DEPRECATED 00090 KDE_DEPRECATED bool isTabReorderingEnabled() const; 00091 #endif 00092 00099 #ifndef KDE_NO_DEPRECATED 00100 KDE_DEPRECATED bool hoverCloseButton() const; 00101 #endif 00102 00109 #ifndef KDE_NO_DEPRECATED 00110 KDE_DEPRECATED bool hoverCloseButtonDelayed() const; 00111 #endif 00112 00120 #ifndef KDE_NO_DEPRECATED 00121 KDE_DEPRECATED bool isCloseButtonEnabled() const; 00122 #endif 00123 00130 #ifndef KDE_NO_DEPRECATED 00131 KDE_DEPRECATED bool tabCloseActivatePrevious() const; 00132 #endif 00133 00138 bool automaticResizeTabs() const; 00139 00144 void setTabBarHidden( bool hide ); 00145 00151 bool isTabBarHidden() const; 00152 00171 QString tabText( int ) const; // but it's not virtual... 00172 00173 #ifdef KDE3_SUPPORT 00174 00177 #ifndef KDE_NO_DEPRECATED 00178 inline KDE_DEPRECATED QString label( int index ) const { return tabText( index ); } 00179 #endif 00180 00184 #ifndef KDE_NO_DEPRECATED 00185 inline KDE_DEPRECATED QString tabLabel( QWidget *w ) const { return tabText( indexOf( w ) ); } 00186 #endif 00187 00191 #ifndef KDE_NO_DEPRECATED 00192 inline KDE_DEPRECATED void setTabLabel( QWidget *w, const QString &l ) { setTabText( indexOf( w ),l ); } 00193 #endif 00194 #endif 00195 00199 void setTabText( int , const QString & ); 00200 00201 using QTabWidget::tabBar; 00202 00203 public Q_SLOTS: 00208 virtual void moveTab( int, int ); 00209 00215 virtual QT_MOC_COMPAT void removePage ( QWidget * w ); 00216 00221 virtual void removeTab(int index); // but it's not virtual in QTabWidget... 00222 00238 #ifndef KDE_NO_DEPRECATED 00239 QT_MOC_COMPAT void setTabReorderingEnabled( bool enable ); 00240 #endif 00241 00249 #ifndef KDE_NO_DEPRECATED 00250 QT_MOC_COMPAT void setHoverCloseButton( bool enable ); 00251 #endif 00252 00259 #ifndef KDE_NO_DEPRECATED 00260 QT_MOC_COMPAT void setHoverCloseButtonDelayed( bool delayed ); 00261 #endif 00262 00272 #ifndef KDE_NO_DEPRECATED 00273 QT_MOC_COMPAT void setCloseButtonEnabled( bool ); 00274 #endif 00275 00282 #ifndef KDE_NO_DEPRECATED 00283 QT_MOC_COMPAT void setTabCloseActivatePrevious( bool previous ); 00284 #endif 00285 00292 void setAutomaticResizeTabs( bool enable ); 00293 00294 Q_SIGNALS: 00298 void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */); 00299 00304 void receivedDropEvent( QDropEvent * ); 00305 00310 void receivedDropEvent( QWidget *, QDropEvent * ); 00311 00315 void initiateDrag( QWidget * ); 00316 00320 void contextMenu( const QPoint & ); 00321 00325 void contextMenu( QWidget *, const QPoint & ); 00326 00331 void movedTab( int, int ); 00332 00337 void mouseDoubleClick(); 00338 00343 void mouseDoubleClick( QWidget * ); 00344 00349 void mouseMiddleClick(); 00350 00355 void mouseMiddleClick( QWidget * ); 00356 00361 void closeRequest( QWidget * ); 00362 00363 protected: 00364 virtual void mouseDoubleClickEvent( QMouseEvent* ); 00365 virtual void mousePressEvent( QMouseEvent* ); 00366 virtual void mouseReleaseEvent( QMouseEvent* ); 00367 virtual void dragEnterEvent( QDragEnterEvent* ); 00368 virtual void dragMoveEvent( QDragMoveEvent* ); 00369 virtual void dropEvent( QDropEvent* ); 00370 int tabBarWidthForMaxChars( int ); 00371 #ifndef QT_NO_WHEELEVENT 00372 virtual void wheelEvent( QWheelEvent* ); 00373 #endif 00374 virtual void resizeEvent( QResizeEvent* ); 00375 virtual void tabInserted( int ); 00376 virtual void tabRemoved ( int ); 00377 00381 #ifndef KDE_NO_DEPRECATED 00382 KDE_DEPRECATED void currentChanged( int ); 00383 #endif 00384 00385 protected Q_SLOTS: 00386 virtual void receivedDropEvent( int, QDropEvent* ); 00387 virtual void initiateDrag( int ); 00388 virtual void contextMenu( int, const QPoint& ); 00389 virtual void mouseDoubleClick( int ); 00390 virtual void mouseMiddleClick( int ); 00391 virtual void closeRequest( int ); 00392 #ifndef QT_NO_WHEELEVENT 00393 virtual void wheelDelta( int ); 00394 #endif 00395 00396 private: 00397 class Private; 00398 Private * const d; 00399 }; 00400 00401 #endif
KDE 4.7 API Reference