Navigation
TabView Vue à onglets
Une barre d'onglets avec sélection, fermeture et réorganisation par glisser-déposer ; les pages sont hébergées par votre application.
Exemple
Impossible de charger l'aperçu des propriétés. Sélectionnez Aperçu des propriétés pour réessayer.

Utilisation
TabView avec pages hébergées
Connectez currentChanged pour synchroniser un StackContentHost et gérez tabMoved lorsque setTabReorderEnabled(true) est activé.
#include <FluentQt/Navigation.h>
using namespace fluent::navigation;
auto* surface = new QWidget(this);
surface->setMinimumWidth(360);
surface->setMaximumWidth(560);
surface->setFixedHeight(186);
surface->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
auto* layout = new QVBoxLayout(surface);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
auto* tabs = new TabView(surface);
tabs->setFixedHeight(40);
tabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
tabs->setTabWidthMode(TabView::TabWidthMode::SizeToContent);
tabs->setTabReorderEnabled(true);
tabs->setTabsClosable(false);
tabs->setAddTabButtonVisible(false);
tabs->addTab(TabViewItem("Home", Typography::Icons::Home));
tabs->addTab(TabViewItem("Details", Typography::Icons::Document));
tabs->addTab(TabViewItem("Activity", Typography::Icons::Calendar));
auto* host = new StackContentHost(surface);
host->setFixedHeight(146);
host->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
for (int i = 0; i < tabs->tabCount(); ++i)
host->insertPage(i, createPage(tabs->tabAt(i).text));
connect(tabs, &TabView::currentChanged,
host, [host](int index) { host->setCurrentIndex(index, 0, true); });
connect(tabs, &TabView::tabMoved,
host, [host](int from, int to) { host->movePage(from, to); });
layout->addWidget(tabs);
layout->addWidget(host);import fluentqt
from PySide6.QtWidgets import QSizePolicy, QVBoxLayout, QWidget
surface = QWidget()
surface.setMinimumWidth(360)
surface.setMaximumWidth(560)
surface.setFixedHeight(186)
surface.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
surface_layout = QVBoxLayout(surface)
surface_layout.setContentsMargins(0, 0, 0, 0)
surface_layout.setSpacing(0)
tabs = fluentqt.TabView(surface)
tabs.setFixedHeight(40)
tabs.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
tabs.setTabWidthMode(fluentqt.TabView.TabWidthMode.SizeToContent)
tabs.setTabReorderEnabled(True)
tabs.setTabsClosable(False)
tabs.setAddTabButtonVisible(False)
tabs.addTab(fluentqt.TabViewItem("Home", fluentqt.Typography.Icons.Home))
tabs.addTab(fluentqt.TabViewItem("Details", fluentqt.Typography.Icons.Document))
tabs.addTab(fluentqt.TabViewItem("Activity", fluentqt.Typography.Icons.Calendar))
host = fluentqt.StackContentHost(surface)
host.setFixedHeight(146)
host.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
for index in range(tabs.tabCount()):
host.insertOwnedPage(index, create_page(tabs.tabAt(index).text))
tabs.currentChanged.connect(lambda index: host.setCurrentIndex(index, 0, True))
tabs.tabMoved.connect(host.movePage)
surface_layout.addWidget(tabs)
surface_layout.addWidget(host)API
DéclarationAucun membre d'API correspondant.