Skip to main content

QCustomTabWidget

QCustomTabWidget

A tokenized tab container.

Built on QTabWidget (correct tab management + keyboard) with three token-styled looks via the tabStyle property: "underline" (default), "pills", "enclosed". Density follows sizeVariant.

At a glance

TierFree (GPLv3)
Importfrom Custom_Widgets.QCustomTabWidget import QCustomTabWidget
Qt DesignerYes — drag it from the palette

Quick start

from Custom_Widgets.QCustomTabWidget import QCustomTabWidget

widget = QCustomTabWidget()
widget.addTab(QLabel(" Revenue is up 12.4% this quarter."), "Overview")
widget.addTab(QLabel(" 4,182 weekly active users."), "Analytics")
widget.addTab(QLabel(" Workspace preferences."), "Settings")
widget.tabStyle = "underline"

That is the exact code behind the screenshot above.

Dark theme

Colours come from the design tokens, so the widget follows the app theme with no extra work.

QCustomTabWidget in dark theme

Properties

Every property below is settable in code and in Qt Designer.

PropertyTypeDefault
tabPositionQTabWidget::TabPosition
tabShapeQTabWidget::TabShape
currentIndexint
countint
iconSizeQSize
elideModeQt::TextElideMode
usesScrollButtonsbool
documentModebool
tabsClosablebool
movablebool
tabBarAutoHidebool
closableTabsboolFalse
showAddButtonboolFalse
tabStyleenum: underline/pills/enclosed``underline
sizeVariantenum: sm/md/lg``md

Signals

Signal
addTabRequested()

Methods

MethodDescription
addTabRequested(...)Add a tab requested.
closableTabs(*args, **kwargs)Closable tabs.
showAddButton(*args, **kwargs)Show the add button.
sizeVariant(*args, **kwargs)Size variant.
tabStyle(*args, **kwargs)Tab style.

Theming

Colours come from the design tokens, so they follow the active theme. Roles used: surface, on-surface, surface-muted, outline, accent, on-primary.

See Design tokens.

QCustomBreadcrumbs · QCustomCommandPalette · QCustomDrawer · QCustomHamburgerMenu · QCustomHeaderNav · QCustomMenu · QCustomPagination · QCustomSidebar