Collections
FileListView
A model-backed file list with complete names, transfer progress, and recovery actions.
Example

Usage
Files and progress
Example transfer states. Remove a file, retry a failed transfer, or advance the progress.
#include <FluentQt/Collections.h>
using namespace fluent::collections;
auto* panel = new QWidget(this);
panel->setMaximumWidth(720);
auto* layout = new QVBoxLayout(panel);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(16);
auto* model = new QStandardItemModel(panel);
auto addFile = [model](const QString& name, const QString& detail,
FileListView::Status state, qreal progress) {
auto* item = new QStandardItem(name);
item->setData(detail, FileListView::MetadataRole);
item->setData(state, FileListView::StatusRole);
item->setData(progress, FileListView::ProgressRole);
item->setData(state == FileListView::Rejected, FileListView::RetryableRole);
model->appendRow(item);
};
addFile("brand-guidelines.pdf", "2.4 MB · Ready to use", FileListView::Ready, 1.0);
addFile("product-shot.png", "3.6 / 5.8 MB · Uploading", FileListView::Uploading, 0.62);
addFile("research-notes-for-the-autumn-product-release-and-accessibility-review.pdf",
"Connection lost · Retry when you are ready", FileListView::Rejected, 0.0);
auto* files = new FileListView(panel);
files->setObjectName("fileList");
files->setAccessibleName("Transfer examples");
files->setMinimumHeight(240);
files->setBackgroundVisible(false);
files->setBorderVisible(false);
files->setProperty("fluentPreserveParentSurface", true);
files->viewport()->setProperty("fluentPreserveParentSurface", true);
files->setModel(model);
layout->addWidget(files);
QObject::connect(files, &FileListView::removeRequested, panel,
[model](const QModelIndex& index) { model->removeRow(index.row()); });
QObject::connect(files, &FileListView::retryRequested, panel,
[model](const QModelIndex& index) {
model->setData(index, FileListView::Uploading, FileListView::StatusRole);
model->setData(index, false, FileListView::RetryableRole);
model->setData(index, "Reconnected · Uploading", FileListView::MetadataRole);
model->setData(index, 0.0, FileListView::ProgressRole);
});
auto* advance = new Button("Advance example transfers", panel);
advance->setObjectName("advanceTransfer");
advance->setFluentStyle(Button::Subtle);
QObject::connect(advance, &Button::clicked, panel, [model]() {
for (int row = 0; row < model->rowCount(); ++row) {
const QModelIndex index = model->index(row, 0);
if (index.data(FileListView::StatusRole).toInt() != FileListView::Uploading)
continue;
const qreal progress = qMin(1.0, index.data(FileListView::ProgressRole).toReal() + 0.19);
model->setData(index, progress, FileListView::ProgressRole);
model->setData(index, progress >= 1.0 ? "Ready to use" : "Uploading",
FileListView::MetadataRole);
if (progress >= 1.0)
model->setData(index, FileListView::Ready, FileListView::StatusRole);
}
});
layout->addWidget(advance, 0, Qt::AlignLeft);import fluentqt
from PySide6.QtCore import Qt
from PySide6.QtGui import QStandardItem, QStandardItemModel
from PySide6.QtWidgets import QVBoxLayout, QWidget
panel = QWidget()
layout = QVBoxLayout(panel)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(24)
model = QStandardItemModel(panel)
roles = fluentqt.FileListView.DataRole
states = fluentqt.FileListView.Status
def add_file(name, detail, state, progress):
item = QStandardItem(name)
item.setData(detail, roles.MetadataRole)
item.setData(state, roles.StatusRole)
item.setData(progress, roles.ProgressRole)
model.appendRow(item)
add_file("brand-guidelines.pdf", "2.4 MB · Ready to use", states.Ready, 1.0)
add_file("product-shot.png", "3.6 / 5.8 MB · Uploading", states.Uploading, 0.62)
add_file(
"research-notes-for-the-autumn-product-release-and-accessibility-review.pdf",
"Connection lost · Retry when you are ready",
states.Rejected,
0.0
)
model.item(2).setData(True, roles.RetryableRole)
files = fluentqt.FileListView(panel)
files.setObjectName("selectedFiles")
files.setAccessibleName("Selected files")
files.setBackgroundVisible(False)
files.setBorderVisible(False)
files.setProperty("fluentPreserveParentSurface", True)
files.viewport().setProperty("fluentPreserveParentSurface", True)
files.setMinimumHeight(260)
files.setModel(model)
layout.addWidget(files)
files.removeRequested.connect(lambda index: model.removeRow(index.row()))
panel.setMaximumWidth(720)
layout.setSpacing(16)
files.setObjectName("fileList")
files.setAccessibleName("Transfer examples")
files.setMinimumHeight(240)
def retry(index):
model.setData(index, states.Uploading, roles.StatusRole)
model.setData(index, False, roles.RetryableRole)
model.setData(
index,
"Reconnected · Uploading",
roles.MetadataRole
)
model.setData(index, 0.0, roles.ProgressRole)
files.retryRequested.connect(retry)
advance = fluentqt.Button("Advance example transfers", panel)
advance.setObjectName("advanceTransfer")
advance.setFluentStyle(fluentqt.Button.ButtonStyle.Subtle)
def advance_transfers():
for row in range(model.rowCount()):
index = model.index(row, 0)
if index.data(roles.StatusRole) != states.Uploading:
continue
progress = min(1.0, float(index.data(roles.ProgressRole)) + 0.19)
model.setData(index, progress, roles.ProgressRole)
model.setData(
index,
"Ready to use" if progress >= 1 else "Uploading",
roles.MetadataRole
)
if progress >= 1:
model.setData(index, states.Ready, roles.StatusRole)
advance.clicked.connect(advance_transfers)
layout.addWidget(advance, 0, Qt.AlignmentFlag.AlignLeft)API
DeclarationNo matching API members.
fluent::collections::FileListView
Inherits ListView
Presents file names, transfer status, and commands from a caller-owned model.
Constructors
Properties
bool animationEnabled- Read
isAnimationEnabled()WritesetAnimationEnabled()NotifyanimationEnabledChanged()
Methods
void setModel(QAbstractItemModel* model) overrideBorrows a model without reparenting or modifying it.
void setAnimationEnabled(bool enabled)Enables short hover and progress transitions, subject to MotionPolicy.
Signals
void removeRequested(const QModelIndex& index)Requests removal; the application decides whether to change its model.
void retryRequested(const QModelIndex& index)Requests retry without starting a transfer or changing file status.
Enumerations
enum StatusFile presentation status; transfer work remains application-owned.
Ready = 0Uploading = 1Rejected = 2
enum DataRoleModel roles used by the file delegate, in addition to Qt::DisplayRole.
MetadataRole = Qt::UserRole + 1StatusRoleProgressRoleRemovableRoleRetryableRole
Destructors
Subclass interfaces
Methods
Inherited from fluent::collections::ListView
Properties
SelectionMode selectionModeSelection mode used by the collection view.
ReadselectionMode()WritesetSelectionMode()NotifyselectionModeChanged()Typography::FontRole fontRoleFluent typography role used for text rendering.
ReadfontRole()WritesetFontRole()NotifyfontRoleChanged()int trailingTextRoleOptional model role for trailing secondary text; -1 hides it.
ReadtrailingTextRole()WritesetTrailingTextRole()NotifytrailingTextRoleChanged()bool viewportHoveredWhether the item-view viewport is currently hovered.
ReadviewportHovered()NotifyviewportHoveredChanged()Flow flowList flow direction used by the underlying item view.
Readflow()WritesetFlow()NotifyflowChanged()qreal selectedIndicatorProgressAnimated progress for the selected-item indicator.
ReadselectedIndicatorProgress()NotifyselectedIndicatorProgressChanged()IndicatorMotionDirection selectedIndicatorMotionDirectionDirection used by selected-indicator motion.
ReadselectedIndicatorMotionDirection()NotifyselectedIndicatorMotionDirectionChanged()bool selectedIndicatorAnimationEnabledWhether selected-indicator animation is enabled.
ReadselectedIndicatorAnimationEnabled()WritesetSelectedIndicatorAnimationEnabled()NotifyselectedIndicatorAnimationEnabledChanged()bool selectionIndicatorVisibleWhether the selected-item indicator is painted.
ReadselectionIndicatorVisible()WritesetSelectionIndicatorVisible()NotifyselectionIndicatorVisibleChanged()bool borderVisibleWhether the control frame border is painted.
ReadborderVisible()WritesetBorderVisible()NotifyborderVisibleChanged()bool backgroundVisibleWhether the control background is painted.
ReadbackgroundVisible()WritesetBackgroundVisible()NotifybackgroundVisibleChanged()QWidget* headerCustom widget hosted in the ListView header area.
Readheader()WritesetHeader()NotifyheaderChanged()QString headerTextConvenience text displayed in the header area.
ReadheaderText()WritesetHeaderText()NotifyheaderTextChanged()QString placeholderTextText shown when the model has no rows to present.
ReadplaceholderText()WritesetPlaceholderText()NotifyplaceholderTextChanged()bool canReorderItemsWhether drag reordering is enabled.
ReadcanReorderItems()WritesetCanReorderItems()NotifycanReorderItemsChanged()bool scrollChainingEnabledWhether boundary wheel input may continue to an enclosing scroller.
ReadisScrollChainingEnabled()WritesetScrollChainingEnabled()NotifyscrollChainingEnabledChanged()bool sectionEnabledWhether section headers are enabled for grouped rows.
ReadsectionEnabled()WritesetSectionEnabled()NotifysectionEnabledChanged()
Methods
Flow flow() constList flow direction used by the underlying item view.
void setFlow(Flow flow)List flow direction used by the underlying item view.
SelectionMode selectionMode() const--- Selection ---
void setSelectionMode(SelectionMode mode)Selection mode used by the collection view.
Typography::FontRole fontRole() const--- Appearance ---
void setFontRole(Typography::FontRole role)Fluent typography role used for text rendering.
int trailingTextRole() constOptional model role for trailing secondary text; -1 hides it.
void setTrailingTextRole(int role)Sets the role used by the default delegate; custom delegates remain caller-owned.
bool borderVisible() constWhether the control frame border is painted.
void setBorderVisible(bool visible)Whether the control frame border is painted.
bool backgroundVisible() constWhether the control background is painted.
void setBackgroundVisible(bool visible)Whether the control background is painted.
QWidget* header() const--- Header / Footer (custom widget API) ---
void setHeader(QWidget* widget)Custom widget hosted in the ListView header area.
QString headerText() const--- Header / Footer (convenience text API) ---
void setHeaderText(const QString& text)Convenience text displayed in the header area.
QString placeholderText() constText shown when the model has no rows to present.
void setPlaceholderText(const QString& text)Text shown when the model has no rows to present.
bool viewportHovered() constWhether the item-view viewport is currently hovered.
bool canReorderItems() const--- Drag reorder ---
void setCanReorderItems(bool enabled)Whether drag reordering is enabled.
bool isScrollChainingEnabled() constWhether boundary wheel input may continue to an enclosing scroller.
void setScrollChainingEnabled(bool enabled)Whether boundary wheel input may continue to an enclosing scroller.
bool sectionEnabled() constWhether section headers are enabled for grouped rows.
void setSectionEnabled(bool enabled)Whether section headers are enabled for grouped rows.
void setSectionKeyFunction(SectionKeyFunc func)设置分组 key 回调。相邻行返回相同 key 的归为一组,key 作为 section header 绘制。
int selectedIndex() const--- Selection API ---
qreal selectedIndicatorProgress() const--- Selected indicator motion API ---
IndicatorMotionDirection selectedIndicatorMotionDirection() constDirection used by selected-indicator motion.
bool selectedIndicatorAnimationEnabled() const控制 selected indicator 过渡动画;关闭后选择变更直接落到目标几何,便于确定性测试。
void setSelectedIndicatorAnimationEnabled(bool enabled)Whether selected-indicator animation is enabled.
bool selectionIndicatorVisible() constReturns whether the selected-item indicator is painted.
void setSelectionIndicatorVisible(bool visible)Shows or hides the indicator without changing selection semantics.
QRectF selectedIndicatorRect() const返回当前绘制用的 selected indicator viewport 几何;无可见选中项时为空。
QRectF selectedIndicatorRect(qreal progress) const返回指定归一化进度下的 selected indicator viewport 几何,供自动化测试验证过渡轨迹。
QRectF selectedIndicatorRectForRow(int row) const返回指定行的 selected indicator viewport 几何;多选模式用于验证每个选中项自己的 reveal 指示器。
void refreshFluentScrollChrome()Suppresses the built-in scroll bars and refreshes the fluent ones.
Signals
void selectionModeChanged()Selection mode used by the collection view.
void fontRoleChanged()Fluent typography role used for text rendering.
void trailingTextRoleChanged()Optional model role for trailing secondary text; -1 hides it.
void viewportHoveredChanged()Whether the item-view viewport is currently hovered.
void flowChanged()List flow direction used by the underlying item view.
void borderVisibleChanged()Whether the control frame border is painted.
void backgroundVisibleChanged()Whether the control background is painted.
void headerChanged()Custom widget hosted in the ListView header area.
void headerTextChanged()Convenience text displayed in the header area.
void placeholderTextChanged()Text shown when the model has no rows to present.
void canReorderItemsChanged()Whether drag reordering is enabled.
void scrollChainingEnabledChanged()Whether boundary wheel input may continue to an enclosing scroller.
void sectionEnabledChanged()Whether section headers are enabled for grouped rows.
void selectedIndicatorProgressChanged()Animated progress for the selected-item indicator.
void selectedIndicatorMotionDirectionChanged()Direction used by selected-indicator motion.
void selectedIndicatorAnimationEnabledChanged()Whether selected-indicator animation is enabled.
void selectionIndicatorVisibleChanged()Whether the selected-item indicator is painted.
void itemClicked(int index)Emits the row once for the same pointer action as inherited clicked().
Enumerations
enum class IndicatorMotionDirectionNoneUpDownLeftRight
Types and aliases
using Flow = QListView::FlowTopToBottom or LeftToRight
using SectionKeyFunc = std::function<QString(int row)>--- Section ---
Inherited from fluent::FluentElement
Methods
static void setTheme(Theme theme)Updates the global theme and notifies active FluentElement instances.
static void setThemeDeferred(Theme theme)Schedules a visible-first batched theme refresh without blocking the current interaction.
static Theme currentTheme()Returns the currently active global theme.
static bool themeUsesDarkAppearance(Theme theme)Returns whether a theme uses dark-backed chrome and material tokens.
static void refreshTheme()Re-broadcasts the current theme to repaint after a design-token change.
static int themeGeneration()Monotonic counter bumped on every theme change, for staleness checks.
Theme effectiveTheme() constResolves the theme used by this element, honoring an inherited QWidget override.
bool effectiveThemeUsesDarkAppearance() constReturns whether this element's effective theme uses dark-backed chrome.
bool setThemeOverrides(const QJsonObject& overrides)Component-facing token accessors.
QJsonObject themeOverrides() constReturns this element's authored overrides.
void clearThemeOverrides()Restores all token fields to global theme defaults.
const Colors& themeColorsRef() constNon-copying access to the active color set (for hot paint paths).
Material::AcrylicToken themeAcrylic() constMaterial, elevation, and adaptive layout tokens.
QColor themeBackdrop(bool active) constWindow-chrome backdrop color for the given activation state.
virtual void onThemeUpdated()Called after the global theme changes.
Enumerations
enum ThemeGlobal visual theme used when resolving design tokens.
Light = 0Dark = 1HighContrast = 2
Types and aliases
struct ColorsDesign token snapshots returned to components.
Inherited from fluent::QMLPlus
Methods
AnchorLayout::Anchors* anchors()Returns mutable anchors for the QWidget host.
void setState(const QString& name)Applies a named state, or clears state when name is empty.
void addState(const QMLState& state)Registers or replaces a named state definition.
void evaluateStates()Reevaluates conditions; the first registered true condition wins.
QMLPlusRuntime* runtime()Returns the lazy host-owned state observation object.
void setAnchors(const AnchorLayout::Anchors& anchors)Replaces all host anchors and invalidates the parent layout.
void resetAnchors()Clears all host anchors and invalidates the parent layout.
void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)Binds a source property to a property on the QWidget host.
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})Installs a managed direct binding on this QWidget host.
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})Installs an explicit-dependency C++ expression on this QWidget host.
void addTransition(const StateTransition& transition)Registers a state transition in precedence order.
void setBehavior(const char* propertyName, const PropertyAnimation& animation)Sets the default animation for this host's managed property writes.
void clearBehavior(const char* propertyName)Removes the default animation for future managed writes.
bool writeProperty(const char* propertyName, const QVariant& value)Writes a host property through Behavior without removing its binding.
All inherited Qt members:QListView