TabWidget

Detailed Description

Classes

class  DockableTabCollection
 
class  TabDragIndicator
 
struct  DockableTabInfo
 
class  DockableTabStyle
 
class  DefaultDockableTabStyle
 
class  DockableTabBar
 
class  DockableTabBarWithCornerWidget
 
class  DockableTabWidget
 
class  SplitTabWidget
 

Enumerations

enum  DockableTabInteractionState {
  NoTabInteraction , MouseOverTab , MouseOverCloseButton , CloseButtonPressActive ,
  CloseButtonPressInactive
}
 

Class Documentation

◆ DockableTabCollection

class DockableTabCollection

Public Member Functions

void registerContainer (DockableTabWidget *widget)
 
void unregisterContainer (DockableTabWidget *widget)
 
const std::set< DockableTabWidget * > & containers () const
 

Member Function Documentation

◆ registerContainer()

void DockableTabCollection::registerContainer ( DockableTabWidget widget)

◆ unregisterContainer()

void DockableTabCollection::unregisterContainer ( DockableTabWidget widget)

◆ containers()

const std::set< DockableTabWidget * > & DockableTabCollection::containers ( ) const
inline

◆ TabDragIndicator

class TabDragIndicator

Public Member Functions

 TabDragIndicator (QPixmap pixmap, QSize size, QPoint pt, QPoint offset, bool newWindow)
 
void moveToMouse (QPoint pt)
 
QPixmap pixmap () const
 
QSize size () const
 
QPoint offset () const
 

Protected Member Functions

virtual QSize sizeHint () const override
 
virtual QSize minimumSizeHint () const override
 
virtual void paintEvent (QPaintEvent *event) override
 

Constructor & Destructor Documentation

◆ TabDragIndicator()

TabDragIndicator::TabDragIndicator ( QPixmap  pixmap,
QSize  size,
QPoint  pt,
QPoint  offset,
bool  newWindow 
)

Member Function Documentation

◆ moveToMouse()

void TabDragIndicator::moveToMouse ( QPoint  pt)

◆ pixmap()

QPixmap TabDragIndicator::pixmap ( ) const
inline

◆ size()

QSize TabDragIndicator::size ( ) const
inline

◆ offset()

QPoint TabDragIndicator::offset ( ) const
inline

◆ sizeHint()

virtual QSize TabDragIndicator::sizeHint ( ) const
overrideprotectedvirtual

◆ minimumSizeHint()

virtual QSize TabDragIndicator::minimumSizeHint ( ) const
overrideprotectedvirtual

◆ paintEvent()

virtual void TabDragIndicator::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

◆ DockableTabInfo

struct DockableTabInfo
Class Members
QString title
QString toolTip
QRect tabRect
QRect closeButtonRect
QRect closeIconRect
bool modifiedIndicator
bool canClose
bool isDrag

◆ DockableTabStyle

class DockableTabStyle

Public Member Functions

virtual ~DockableTabStyle ()
 
virtual QSize sizeForTab (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const
 
virtual QRect closeButtonRect (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const
 
virtual QRect closeIconRect (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const
 
virtual void paintTab (const QWidget *widget, QStylePainter &p, const DockableTabInfo &info, int idx, int count, int active, DockableTabInteractionState state, const QRect &rect) const
 
virtual void paintBase (const QWidget *widget, QStylePainter &p, const QRect &rect, const QRect &activeRect) const
 
virtual DockableTabStyleduplicate ()
 

Constructor & Destructor Documentation

◆ ~DockableTabStyle()

virtual DockableTabStyle::~DockableTabStyle ( )
inlinevirtual

Member Function Documentation

◆ sizeForTab()

virtual QSize DockableTabStyle::sizeForTab ( const QWidget *  widget,
const DockableTabInfo info,
int  idx,
int  count,
int  active 
) const
virtual

◆ closeButtonRect()

virtual QRect DockableTabStyle::closeButtonRect ( const QWidget *  widget,
const DockableTabInfo info,
int  idx,
int  count,
int  active 
) const
virtual

◆ closeIconRect()

virtual QRect DockableTabStyle::closeIconRect ( const QWidget *  widget,
const DockableTabInfo info,
int  idx,
int  count,
int  active 
) const
virtual

◆ paintTab()

virtual void DockableTabStyle::paintTab ( const QWidget *  widget,
QStylePainter &  p,
const DockableTabInfo info,
int  idx,
int  count,
int  active,
DockableTabInteractionState  state,
const QRect &  rect 
) const
virtual

◆ paintBase()

virtual void DockableTabStyle::paintBase ( const QWidget *  widget,
QStylePainter &  p,
const QRect &  rect,
const QRect &  activeRect 
) const
virtual

Reimplemented in DefaultDockableTabStyle.

◆ duplicate()

virtual DockableTabStyle * DockableTabStyle::duplicate ( )
virtual

◆ DefaultDockableTabStyle

class DefaultDockableTabStyle

Public Member Functions

virtual QSize sizeForTab (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const override
 
virtual QRect closeButtonRect (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const override
 
virtual QRect closeIconRect (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const override
 
virtual void paintTab (const QWidget *widget, QStylePainter &p, const DockableTabInfo &info, int idx, int count, int active, DockableTabInteractionState state, const QRect &rect) const override
 
virtual void paintBase (const QWidget *widget, QStylePainter &p, const QRect &rect, const QRect &activeRect) const override
 
virtual DockableTabStyleduplicate () override
 
- Public Member Functions inherited from DockableTabStyle
virtual ~DockableTabStyle ()
 
virtual QSize sizeForTab (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const
 
virtual QRect closeButtonRect (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const
 
virtual QRect closeIconRect (const QWidget *widget, const DockableTabInfo &info, int idx, int count, int active) const
 
virtual void paintTab (const QWidget *widget, QStylePainter &p, const DockableTabInfo &info, int idx, int count, int active, DockableTabInteractionState state, const QRect &rect) const
 
virtual void paintBase (const QWidget *widget, QStylePainter &p, const QRect &rect, const QRect &activeRect) const
 
virtual DockableTabStyleduplicate ()
 

Member Function Documentation

◆ sizeForTab()

virtual QSize DefaultDockableTabStyle::sizeForTab ( const QWidget *  widget,
const DockableTabInfo info,
int  idx,
int  count,
int  active 
) const
overridevirtual

Reimplemented from DockableTabStyle.

◆ closeButtonRect()

virtual QRect DefaultDockableTabStyle::closeButtonRect ( const QWidget *  widget,
const DockableTabInfo info,
int  idx,
int  count,
int  active 
) const
overridevirtual

Reimplemented from DockableTabStyle.

◆ closeIconRect()

virtual QRect DefaultDockableTabStyle::closeIconRect ( const QWidget *  widget,
const DockableTabInfo info,
int  idx,
int  count,
int  active 
) const
overridevirtual

Reimplemented from DockableTabStyle.

◆ paintTab()

virtual void DefaultDockableTabStyle::paintTab ( const QWidget *  widget,
QStylePainter &  p,
const DockableTabInfo info,
int  idx,
int  count,
int  active,
DockableTabInteractionState  state,
const QRect &  rect 
) const
overridevirtual

Reimplemented from DockableTabStyle.

◆ paintBase()

virtual void DefaultDockableTabStyle::paintBase ( const QWidget *  widget,
QStylePainter &  p,
const QRect &  rect,
const QRect &  activeRect 
) const
overridevirtual

Reimplemented from DockableTabStyle.

◆ duplicate()

virtual DockableTabStyle * DefaultDockableTabStyle::duplicate ( )
overridevirtual

Reimplemented from DockableTabStyle.

◆ DockableTabBar

class DockableTabBar

Signals

void currentChanged (int idx)
 
void tabCloseRequested (int idx)
 
void tabMoved (int oldIdx, int newIdx)
 
void newWindowForTab (int idx, QRect rectHint)
 
void reparentTab (int oldIdx, DockableTabWidget *target, int newIdx)
 
void splitTab (int idx, Qt::Edge edge)
 

Public Member Functions

 DockableTabBar (DockableTabCollection *collection)
 
virtual ~DockableTabBar ()
 
int addTab (const QString &title)
 
int insertTab (int idx, const QString &title)
 
void removeTab (int idx)
 
void setCurrentIndex (int idx)
 
void setTabText (int idx, const QString &title)
 
void setTabToolTip (int idx, const QString &toolTip)
 
void setTabModifiedIndicator (int idx, bool indicator)
 
void setCanCloseTab (int idx, bool canClose)
 
void setCanCreateNewWindow (bool canCreate)
 
void setCanSplit (bool canSplit)
 
int count () const
 
int currentIndex () const
 
int tabAt (const QPoint &pt)
 
QRect tabRect (int idx)
 
QString tabText (int idx)
 
QString tabToolTip (int idx)
 
bool tabModifiedIndicator (int idx)
 
bool canCloseTab (int idx)
 
bool canCreateNewWindow ()
 
bool canSplit ()
 
void ensureCurrentTabVisible ()
 
DockableTabStyletabStyle () const
 
void setTabStyle (DockableTabStyle *style)
 

Protected Member Functions

virtual QSize sizeHint () const override
 
virtual QSize minimumSizeHint () const override
 
virtual void paintEvent (QPaintEvent *event) override
 
virtual void enterEvent (QEnterEvent *event) override
 
virtual void leaveEvent (QEvent *event) override
 
virtual void mouseMoveEvent (QMouseEvent *event) override
 
virtual void mousePressEvent (QMouseEvent *event) override
 
virtual void mouseReleaseEvent (QMouseEvent *event) override
 
virtual void resizeEvent (QResizeEvent *event) override
 
virtual void wheelEvent (QWheelEvent *event) override
 

Constructor & Destructor Documentation

◆ DockableTabBar()

DockableTabBar::DockableTabBar ( DockableTabCollection collection)

◆ ~DockableTabBar()

virtual DockableTabBar::~DockableTabBar ( )
virtual

Member Function Documentation

◆ addTab()

int DockableTabBar::addTab ( const QString &  title)

◆ insertTab()

int DockableTabBar::insertTab ( int  idx,
const QString &  title 
)

◆ removeTab()

void DockableTabBar::removeTab ( int  idx)

◆ setCurrentIndex()

void DockableTabBar::setCurrentIndex ( int  idx)

◆ setTabText()

void DockableTabBar::setTabText ( int  idx,
const QString &  title 
)

◆ setTabToolTip()

void DockableTabBar::setTabToolTip ( int  idx,
const QString &  toolTip 
)

◆ setTabModifiedIndicator()

void DockableTabBar::setTabModifiedIndicator ( int  idx,
bool  indicator 
)

◆ setCanCloseTab()

void DockableTabBar::setCanCloseTab ( int  idx,
bool  canClose 
)

◆ setCanCreateNewWindow()

void DockableTabBar::setCanCreateNewWindow ( bool  canCreate)

◆ setCanSplit()

void DockableTabBar::setCanSplit ( bool  canSplit)

◆ count()

int DockableTabBar::count ( ) const

◆ currentIndex()

int DockableTabBar::currentIndex ( ) const

◆ tabAt()

int DockableTabBar::tabAt ( const QPoint &  pt)

◆ tabRect()

QRect DockableTabBar::tabRect ( int  idx)

◆ tabText()

QString DockableTabBar::tabText ( int  idx)

◆ tabToolTip()

QString DockableTabBar::tabToolTip ( int  idx)

◆ tabModifiedIndicator()

bool DockableTabBar::tabModifiedIndicator ( int  idx)

◆ canCloseTab()

bool DockableTabBar::canCloseTab ( int  idx)

◆ canCreateNewWindow()

bool DockableTabBar::canCreateNewWindow ( )

◆ canSplit()

bool DockableTabBar::canSplit ( )

◆ ensureCurrentTabVisible()

void DockableTabBar::ensureCurrentTabVisible ( )

◆ tabStyle()

DockableTabStyle * DockableTabBar::tabStyle ( ) const
inline

◆ setTabStyle()

void DockableTabBar::setTabStyle ( DockableTabStyle style)

◆ currentChanged

void DockableTabBar::currentChanged ( int  idx)
signal

◆ tabCloseRequested

void DockableTabBar::tabCloseRequested ( int  idx)
signal

◆ tabMoved

void DockableTabBar::tabMoved ( int  oldIdx,
int  newIdx 
)
signal

◆ newWindowForTab

void DockableTabBar::newWindowForTab ( int  idx,
QRect  rectHint 
)
signal

◆ reparentTab

void DockableTabBar::reparentTab ( int  oldIdx,
DockableTabWidget target,
int  newIdx 
)
signal

◆ splitTab

void DockableTabBar::splitTab ( int  idx,
Qt::Edge  edge 
)
signal

◆ sizeHint()

virtual QSize DockableTabBar::sizeHint ( ) const
overrideprotectedvirtual

◆ minimumSizeHint()

virtual QSize DockableTabBar::minimumSizeHint ( ) const
overrideprotectedvirtual

◆ paintEvent()

virtual void DockableTabBar::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

◆ enterEvent()

virtual void DockableTabBar::enterEvent ( QEnterEvent *  event)
overrideprotectedvirtual

◆ leaveEvent()

virtual void DockableTabBar::leaveEvent ( QEvent *  event)
overrideprotectedvirtual

◆ mouseMoveEvent()

virtual void DockableTabBar::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

◆ mousePressEvent()

virtual void DockableTabBar::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

◆ mouseReleaseEvent()

virtual void DockableTabBar::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

◆ resizeEvent()

virtual void DockableTabBar::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

◆ wheelEvent()

virtual void DockableTabBar::wheelEvent ( QWheelEvent *  event)
overrideprotectedvirtual

◆ DockableTabBarWithCornerWidget

class DockableTabBarWithCornerWidget

Public Member Functions

 DockableTabBarWithCornerWidget (DockableTabBar *bar)
 
DockableTabBartabBar () const
 
void setCornerWidget (QWidget *widget, Qt::Corner corner=Qt::TopRightCorner, bool expanding=false)
 
Qt::Corner corner () const
 
QWidget * cornerWidget () const
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *event) override
 

Constructor & Destructor Documentation

◆ DockableTabBarWithCornerWidget()

DockableTabBarWithCornerWidget::DockableTabBarWithCornerWidget ( DockableTabBar bar)

Member Function Documentation

◆ paintEvent()

virtual void DockableTabBarWithCornerWidget::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

◆ tabBar()

DockableTabBar * DockableTabBarWithCornerWidget::tabBar ( ) const
inline

◆ setCornerWidget()

void DockableTabBarWithCornerWidget::setCornerWidget ( QWidget *  widget,
Qt::Corner  corner = Qt::TopRightCorner,
bool  expanding = false 
)

◆ corner()

Qt::Corner DockableTabBarWithCornerWidget::corner ( ) const
inline

◆ cornerWidget()

QWidget * DockableTabBarWithCornerWidget::cornerWidget ( ) const
inline

◆ DockableTabWidget

class DockableTabWidget

Signals

void tabCloseRequested (int idx)
 
void currentChanged (int idx)
 
void tabMoved (int oldIdx, int newIdx)
 
void newWindowForTab (int idx, QRect rectHint)
 
void tabRemovedForReparent (int oldIdx, QWidget *widget, DockableTabWidget *target, int newIdx)
 
void tabAddedForReparent (int idx, DockableTabWidget *source)
 
void splitTab (int idx, Qt::Edge edge)
 

Public Member Functions

 DockableTabWidget (DockableTabCollection *collection, DockableTabBar *bar=nullptr)
 
int addTab (QWidget *widget, const QString &title)
 
int insertTab (int idx, QWidget *widget, const QString &title)
 
void removeTab (int idx)
 
int count ()
 
int currentIndex ()
 
QWidget * currentWidget ()
 
QWidget * widget (int idx)
 
DockableTabBartabBar () const
 
QStackedWidget * container () const
 
DockableTabCollectioncollection () const
 
QString tabText (int idx)
 
bool tabModifiedIndicator (int idx)
 
bool canCloseTab (int idx)
 
bool canCreateNewWindow ()
 
bool canSplit ()
 
int indexOf (QWidget *widget)
 
void setCurrentIndex (int idx)
 
void setTabText (int idx, const QString &title)
 
void setTabToolTip (int idx, const QString &toolTip)
 
void setTabModifiedIndicator (int idx, bool indicator)
 
void setCanCloseTab (int idx, bool canClose)
 
void setCanCreateNewWindow (bool canCreate)
 
void setCanSplit (bool canSplit)
 
void setCornerWidget (QWidget *widget, Qt::Corner corner=Qt::TopRightCorner, bool expanding=false)
 
Qt::Corner corner () const
 
QWidget * cornerWidget () const
 
DockableTabStyletabStyle () const
 
void setTabStyle (DockableTabStyle *style)
 
virtual QSize sizeHint () const override
 

Constructor & Destructor Documentation

◆ DockableTabWidget()

DockableTabWidget::DockableTabWidget ( DockableTabCollection collection,
DockableTabBar bar = nullptr 
)

Member Function Documentation

◆ addTab()

int DockableTabWidget::addTab ( QWidget *  widget,
const QString &  title 
)

◆ insertTab()

int DockableTabWidget::insertTab ( int  idx,
QWidget *  widget,
const QString &  title 
)

◆ removeTab()

void DockableTabWidget::removeTab ( int  idx)

◆ count()

int DockableTabWidget::count ( )

◆ currentIndex()

int DockableTabWidget::currentIndex ( )

◆ currentWidget()

QWidget * DockableTabWidget::currentWidget ( )

◆ widget()

QWidget * DockableTabWidget::widget ( int  idx)

◆ tabBar()

DockableTabBar * DockableTabWidget::tabBar ( ) const
inline

◆ container()

QStackedWidget * DockableTabWidget::container ( ) const
inline

◆ collection()

DockableTabCollection * DockableTabWidget::collection ( ) const
inline

◆ tabText()

QString DockableTabWidget::tabText ( int  idx)

◆ tabModifiedIndicator()

bool DockableTabWidget::tabModifiedIndicator ( int  idx)

◆ canCloseTab()

bool DockableTabWidget::canCloseTab ( int  idx)

◆ canCreateNewWindow()

bool DockableTabWidget::canCreateNewWindow ( )

◆ canSplit()

bool DockableTabWidget::canSplit ( )

◆ indexOf()

int DockableTabWidget::indexOf ( QWidget *  widget)

◆ setCurrentIndex()

void DockableTabWidget::setCurrentIndex ( int  idx)

◆ setTabText()

void DockableTabWidget::setTabText ( int  idx,
const QString &  title 
)

◆ setTabToolTip()

void DockableTabWidget::setTabToolTip ( int  idx,
const QString &  toolTip 
)

◆ setTabModifiedIndicator()

void DockableTabWidget::setTabModifiedIndicator ( int  idx,
bool  indicator 
)

◆ setCanCloseTab()

void DockableTabWidget::setCanCloseTab ( int  idx,
bool  canClose 
)

◆ setCanCreateNewWindow()

void DockableTabWidget::setCanCreateNewWindow ( bool  canCreate)

◆ setCanSplit()

void DockableTabWidget::setCanSplit ( bool  canSplit)

◆ setCornerWidget()

void DockableTabWidget::setCornerWidget ( QWidget *  widget,
Qt::Corner  corner = Qt::TopRightCorner,
bool  expanding = false 
)

◆ corner()

Qt::Corner DockableTabWidget::corner ( ) const

◆ cornerWidget()

QWidget * DockableTabWidget::cornerWidget ( ) const

◆ tabStyle()

DockableTabStyle * DockableTabWidget::tabStyle ( ) const
inline

◆ setTabStyle()

void DockableTabWidget::setTabStyle ( DockableTabStyle style)

◆ sizeHint()

virtual QSize DockableTabWidget::sizeHint ( ) const
overridevirtual

◆ tabCloseRequested

void DockableTabWidget::tabCloseRequested ( int  idx)
signal

◆ currentChanged

void DockableTabWidget::currentChanged ( int  idx)
signal

◆ tabMoved

void DockableTabWidget::tabMoved ( int  oldIdx,
int  newIdx 
)
signal

◆ newWindowForTab

void DockableTabWidget::newWindowForTab ( int  idx,
QRect  rectHint 
)
signal

◆ tabRemovedForReparent

void DockableTabWidget::tabRemovedForReparent ( int  oldIdx,
QWidget *  widget,
DockableTabWidget target,
int  newIdx 
)
signal

◆ tabAddedForReparent

void DockableTabWidget::tabAddedForReparent ( int  idx,
DockableTabWidget source 
)
signal

◆ splitTab

void DockableTabWidget::splitTab ( int  idx,
Qt::Edge  edge 
)
signal

◆ SplitTabWidget

class SplitTabWidget

Signals

void tabClosed (QWidget *widget)
 
void currentChanged (QWidget *widget)
 
void layoutChanged ()
 
void splitSizeChanged ()
 

Public Member Functions

 SplitTabWidget (DockableTabCollection *collection)
 
void addTab (QWidget *widget, const QString &title)
 
bool removeTab (QWidget *widget)
 
void setCanCloseTab (QWidget *widget, bool canClose)
 
void enumerateTabs (const std::function< void(QWidget *)> &func)
 
void selectWidget (QWidget *widget)
 
bool isWidgetVisible (QWidget *widget)
 
bool closeTab (QWidget *widget)
 
void setTabStyle (DockableTabStyle *style)
 
void setCornerWidget (QWidget *widget, Qt::Corner corner=Qt::TopRightCorner, bool expanding=false)
 
QString savedLayoutString () const
 
void restoreLayoutString (const QString &layout)
 

Constructor & Destructor Documentation

◆ SplitTabWidget()

SplitTabWidget::SplitTabWidget ( DockableTabCollection collection)

Member Function Documentation

◆ addTab()

void SplitTabWidget::addTab ( QWidget *  widget,
const QString &  title 
)

◆ removeTab()

bool SplitTabWidget::removeTab ( QWidget *  widget)

◆ setCanCloseTab()

void SplitTabWidget::setCanCloseTab ( QWidget *  widget,
bool  canClose 
)

◆ enumerateTabs()

void SplitTabWidget::enumerateTabs ( const std::function< void(QWidget *)> &  func)

◆ selectWidget()

void SplitTabWidget::selectWidget ( QWidget *  widget)

◆ isWidgetVisible()

bool SplitTabWidget::isWidgetVisible ( QWidget *  widget)

◆ closeTab()

bool SplitTabWidget::closeTab ( QWidget *  widget)

◆ setTabStyle()

void SplitTabWidget::setTabStyle ( DockableTabStyle style)

◆ setCornerWidget()

void SplitTabWidget::setCornerWidget ( QWidget *  widget,
Qt::Corner  corner = Qt::TopRightCorner,
bool  expanding = false 
)

◆ savedLayoutString()

QString SplitTabWidget::savedLayoutString ( ) const

◆ restoreLayoutString()

void SplitTabWidget::restoreLayoutString ( const QString &  layout)

◆ tabClosed

void SplitTabWidget::tabClosed ( QWidget *  widget)
signal

◆ currentChanged

void SplitTabWidget::currentChanged ( QWidget *  widget)
signal

◆ layoutChanged

void SplitTabWidget::layoutChanged ( )
signal

◆ splitSizeChanged

void SplitTabWidget::splitSizeChanged ( )
signal

Enumeration Type Documentation

◆ DockableTabInteractionState

Enumerator
NoTabInteraction 
MouseOverTab 
MouseOverCloseButton 
CloseButtonPressActive 
CloseButtonPressInactive