コレクション
FileListView ファイルリスト
完全なファイル名、転送の進行状況、リカバリアクションを備えたモデル駆動のファイルリストです。
サンプル
プロパティプレビューを読み込めませんでした。もう一度「プロパティプレビュー」を選択して再試行してください。

使い方
ファイルと進行状況
転送状態の例です。ファイルの削除、失敗した転送の再試行、進行状況の更新を行えます。
#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
宣言を表示一致する API メンバーはありません。
fluent::collections::FileListView
継承元 ListView
ファイル名、転送状態、および行ごとの削除/再試行アクションを表示するリストビューです。ディスク I/O なしで Qt アイテムモデルによって駆動され、Delete キーで削除、Ctrl/Cmd+R で再試行をリクエストします。
コンストラクタ
デストラクタ
列挙型
enum Statusファイル行の表示状態です。実際の転送処理はアプリケーション側で行います。
Ready = 0Uploading = 1Rejected = 2
enum DataRoleQt::DisplayRole に加えて読み取られるモデルロールです。MetadataRole(QString)、StatusRole(Status、既定値は Ready)、ProgressRole([0, 1])、RemovableRole(bool、既定値は true)、RetryableRole(bool、Rejected 行の既定値は false)があります。
MetadataRole = Qt::UserRole + 1StatusRoleProgressRoleRemovableRoleRetryableRole
メソッド
void setModel(QAbstractItemModel* model) overrideアイテムモデルを設定します(引き続き呼び出し元で管理されます)。
void setAnimationEnabled(bool enabled)ホバーおよび進捗トランジションアニメーションの有効・無効を切り替えます(MotionPolicy に従います)。
プロパティ
bool animationEnabled- 読み取り
isAnimationEnabled()書き込みsetAnimationEnabled()通知シグナルanimationEnabledChanged()
シグナル
void removeRequested(const QModelIndex& index)ユーザーが行の削除をトリガーしたときに送出されます。モデルの更新は呼び出し側で行います。
void retryRequested(const QModelIndex& index)ユーザーが Rejected 状態の行の再試行をトリガーしたときに送出されます。
protected メンバー
メソッド
fluent::collections::ListView から継承
列挙型
enum class IndicatorMotionDirectionNoneUpDownLeftRight
メソッド
Flow flow() constアイテムの配置方向(TopToBottom または LeftToRight)。
void setFlow(Flow flow)アイテムの配置方向(TopToBottom または LeftToRight)。
SelectionMode selectionMode() constコレクションビューで使用される選択モードです。
void setSelectionMode(SelectionMode mode)コレクションビューで使用される選択モードです。
Typography::FontRole fontRole() constテキスト描画に使用される Fluent タイポグラフィロール。
void setFontRole(Typography::FontRole role)テキスト描画に使用される Fluent タイポグラフィロール。
int trailingTextRole() const末尾の補助テキスト用のオプションのモデルロール。-1 を指定すると非表示になります。
void setTrailingTextRole(int role)デフォルトデリゲートが末尾テキストに使用するロールを設定します。カスタムデリゲートは独自のレイアウトを処理します。
bool borderVisible() constコントロールの枠線を描画するかどうか。
void setBorderVisible(bool visible)コントロールの枠線を描画するかどうか。
bool backgroundVisible() constコントロールの背景を描画するかどうか。
void setBackgroundVisible(bool visible)コントロールの背景を描画するかどうか。
QWidget* header() constListView のヘッダー領域にホストされるカスタムウィジェット。
void setHeader(QWidget* widget)ListView のヘッダー領域にホストされるカスタムウィジェット。
QString headerText() constヘッダー領域に表示される簡易テキスト。
void setHeaderText(const QString& text)ヘッダー領域に表示される簡易テキスト。
QString placeholderText() constモデルに項目がないときに表示されるテキストです。
void setPlaceholderText(const QString& text)モデルに項目がないときに表示されるテキストです。
bool viewportHovered() constビューポートが現在ホバーされているかどうか。
bool canReorderItems() constドラッグによる並べ替えが有効かどうかです。
void setCanReorderItems(bool enabled)ドラッグによる並べ替えが有効かどうかです。
bool isScrollChainingEnabled() constスクロール境界でのホイール入力を外側のスクローラーへ引き継ぐかどうかです。
void setScrollChainingEnabled(bool enabled)スクロール境界でのホイール入力を外側のスクローラーへ引き継ぐかどうかです。
bool sectionEnabled() constセクションキーコールバックを使用して、隣接する項目をセクションヘッダー配下にグループ化するかどうかです。
void setSectionEnabled(bool enabled)セクションキーコールバックを使用して、隣接する項目をセクションヘッダー配下にグループ化するかどうかです。
void setSectionKeyFunction(SectionKeyFunc func)行ごとにセクションキーを返すコールバックを設定します。同じキーを持つ連続した行はセクションヘッダーを共有します。
qreal selectedIndicatorProgress() const選択項目インジケーターのアニメーション進捗。
IndicatorMotionDirection selectedIndicatorMotionDirection() const選択インジケーターのモーションで使用される方向。
bool selectedIndicatorAnimationEnabled() const選択インジケーターが行間をアニメーション移動するかどうか。無効にすると、ターゲット矩形へ即座にスナップします。
void setSelectedIndicatorAnimationEnabled(bool enabled)選択インジケーターのアニメーションを有効にするかどうか。
bool selectionIndicatorVisible() const選択項目インジケーターを描画するかどうか。
void setSelectionIndicatorVisible(bool visible)選択動作に影響を与えずに、選択インジケーターを表示または非表示にします。
QRectF selectedIndicatorRect() constビューポート座標系における現在の選択インジケーター矩形を返します。表示されているものがない場合は空の矩形を返します。
QRectF selectedIndicatorRect(qreal progress) const[0, 1] の正規化されたアニメーション進行度における選択インジケーター矩形を返します。
QRectF selectedIndicatorRectForRow(int row) const特定の行の選択インジケーター矩形を返します(複数選択モードで使用されます)。
void refreshFluentScrollChrome()ネイティブスクロールバーを非表示にし、Fluent オーバーレイスクロールバーを更新します。QComboBox のポップアップ内などで表示後にプラットフォームスタイルがネイティブバーを復元する場合は、再度呼び出してください。
プロパティ
SelectionMode selectionModeコレクションビューで使用される選択モードです。
読み取りselectionMode()書き込みsetSelectionMode()通知シグナルselectionModeChanged()Typography::FontRole fontRoleテキスト描画に使用される Fluent タイポグラフィロール。
読み取りfontRole()書き込みsetFontRole()通知シグナルfontRoleChanged()int trailingTextRole末尾の補助テキスト用のオプションのモデルロール。-1 を指定すると非表示になります。
読み取りtrailingTextRole()書き込みsetTrailingTextRole()通知シグナルtrailingTextRoleChanged()bool viewportHoveredビューポートが現在ホバーされているかどうか。
読み取りviewportHovered()通知シグナルviewportHoveredChanged()Flow flowアイテムの配置方向(TopToBottom または LeftToRight)。
読み取りflow()書き込みsetFlow()通知シグナルflowChanged()qreal selectedIndicatorProgress選択項目インジケーターのアニメーション進捗。
読み取りselectedIndicatorProgress()通知シグナルselectedIndicatorProgressChanged()IndicatorMotionDirection selectedIndicatorMotionDirection選択インジケーターのモーションで使用される方向。
読み取りselectedIndicatorMotionDirection()通知シグナルselectedIndicatorMotionDirectionChanged()bool selectedIndicatorAnimationEnabled選択インジケーターのアニメーションを有効にするかどうか。
読み取りselectedIndicatorAnimationEnabled()書き込みsetSelectedIndicatorAnimationEnabled()通知シグナルselectedIndicatorAnimationEnabledChanged()bool selectionIndicatorVisible選択項目インジケーターを描画するかどうか。
読み取りselectionIndicatorVisible()書き込みsetSelectionIndicatorVisible()通知シグナルselectionIndicatorVisibleChanged()bool borderVisibleコントロールの枠線を描画するかどうか。
読み取りborderVisible()書き込みsetBorderVisible()通知シグナルborderVisibleChanged()bool backgroundVisibleコントロールの背景を描画するかどうか。
読み取りbackgroundVisible()書き込みsetBackgroundVisible()通知シグナルbackgroundVisibleChanged()QWidget* headerListView のヘッダー領域にホストされるカスタムウィジェット。
読み取りheader()書き込みsetHeader()通知シグナルheaderChanged()QString headerTextヘッダー領域に表示される簡易テキスト。
読み取りheaderText()書き込みsetHeaderText()通知シグナルheaderTextChanged()QString placeholderTextモデルに項目がないときに表示されるテキストです。
読み取りplaceholderText()書き込みsetPlaceholderText()通知シグナルplaceholderTextChanged()bool canReorderItemsドラッグによる並べ替えが有効かどうかです。
読み取りcanReorderItems()書き込みsetCanReorderItems()通知シグナルcanReorderItemsChanged()bool scrollChainingEnabledスクロール境界でのホイール入力を外側のスクローラーへ引き継ぐかどうかです。
読み取りisScrollChainingEnabled()書き込みsetScrollChainingEnabled()通知シグナルscrollChainingEnabledChanged()bool sectionEnabledセクションキーコールバックを使用して、隣接する項目をセクションヘッダー配下にグループ化するかどうかです。
読み取りsectionEnabled()書き込みsetSectionEnabled()通知シグナルsectionEnabledChanged()
シグナル
void selectionModeChanged()コレクションビューで使用される選択モードです。
void fontRoleChanged()テキスト描画に使用される Fluent タイポグラフィロール。
void trailingTextRoleChanged()末尾の補助テキスト用のオプションのモデルロール。-1 を指定すると非表示になります。
void viewportHoveredChanged()ビューポートが現在ホバーされているかどうか。
void flowChanged()アイテムの配置方向(TopToBottom または LeftToRight)。
void borderVisibleChanged()コントロールの枠線を描画するかどうか。
void backgroundVisibleChanged()コントロールの背景を描画するかどうか。
void headerChanged()ListView のヘッダー領域にホストされるカスタムウィジェット。
void headerTextChanged()ヘッダー領域に表示される簡易テキスト。
void placeholderTextChanged()モデルに項目がないときに表示されるテキストです。
void canReorderItemsChanged()ドラッグによる並べ替えが有効かどうかです。
void scrollChainingEnabledChanged()スクロール境界でのホイール入力を外側のスクローラーへ引き継ぐかどうかです。
void sectionEnabledChanged()セクションキーコールバックを使用して、隣接する項目をセクションヘッダー配下にグループ化するかどうかです。
void selectedIndicatorProgressChanged()選択項目インジケーターのアニメーション進捗。
void selectedIndicatorMotionDirectionChanged()選択インジケーターのモーションで使用される方向。
void selectedIndicatorAnimationEnabledChanged()選択インジケーターのアニメーションを有効にするかどうか。
void selectionIndicatorVisibleChanged()選択項目インジケーターを描画するかどうか。
void itemClicked(int index)QAbstractItemView::clicked() と併せて、クリックされた行インデックスを送出する便利なシグナル。
型とエイリアス
fluent::FluentElement から継承
列挙型
enum Themeデザイントークン解決時に使用されるグローバルな視覚テーマ。
Light = 0Dark = 1HighContrast = 2
メソッド
static void setTheme(Theme theme)グローバルテーマを更新し、アクティブな FluentElement インスタンスに通知します。
static void setThemeDeferred(Theme theme)現在の操作をブロックせずに、可視要素を優先したバッチ処理でテーマの更新をスケジュールします。
static Theme currentTheme()現在有効なグローバルテーマを返します。
static bool themeUsesDarkAppearance(Theme theme)テーマがダークベースのクロームおよびマテリアルトークンを使用するかどうかを返します。
static void refreshTheme()デザイントークンの変更後に再描画するため、現在のテーマを再ブロードキャストします。
static int themeGeneration()テーマ変更ごとに加算される単調増加カウンターです。鮮度チェックに使用されます。
Theme effectiveTheme() const継承された QWidget の上書きを尊重し、この要素が使用するテーマを解決します。
bool effectiveThemeUsesDarkAppearance() constこの要素の有効なテーマがダークベースのクロームを使用するかどうかを返します。
bool setThemeOverrides(const QJsonObject& overrides)この要素のスパースな色、角丸半径、フォントトークンの上書きを置き換えます。
QJsonObject themeOverrides() constこの要素に設定されたオーバーライドを返します。
void clearThemeOverrides()すべてのトークンフィールドをグローバルテーマの既定値に復元します。
const Colors& themeColorsRef() const描画のホットパス向けにアクティブなカラーセットへ非コピーでアクセスします。
Material::AcrylicToken themeAcrylic() constマテリアル、エレベーション、およびアダプティブレイアウトのトークン。
QColor themeBackdrop(bool active) const指定されたアクティブ状態に対するウィンドウ chrome の背景色。
virtual void onThemeUpdated()グローバルテーマの変更後に呼び出されます。
型とエイリアス
struct Colorsコンポーネントに返されるデザイントークンのスナップショット。
fluent::QMLPlus から継承
メソッド
AnchorLayout::Anchors* anchors()QWidget ホストの変更可能なアンカーを返します。
void setState(const QString& name)登録済みの状態を名前で適用するか、@p name が空の場合はデフォルト状態を復元します。未知の名前は無視され、その状態を離れると既存のバインディングが再開されます。
void addState(const QMLState& state)名前付き状態定義を登録または置換します。アクティブな状態を置換した場合は即座に適用されます。
void evaluateStates()登録順に状態条件を再評価し、最初に一致した状態(一致しない場合はデフォルト状態)をアクティブにします。依存プロパティの変更通知時にも自動実行され、extend を使用する派生状態は、循環や欠損がない限り祖先の変更を継承します。
QMLPlusRuntime* runtime()このホストが所有し、遅延生成される状態オブザーバーを返します。
void setAnchors(const AnchorLayout::Anchors& anchors)すべてのホストアンカーを置き換え、親レイアウトを無効化します。
void resetAnchors()ホストのすべてのアンカーをクリアし、親レイアウトを無効化します。
void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)PropertyBinder::bind() を介して、@p source の @p sourceProp をこの QWidget ホストの @p targetProp にバインドします。
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})この QWidget ホストに管理された直接バインディングを設定します。
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})この QWidget ホストに明示的依存関係を持つ C++ 式を設定します。
void addTransition(const StateTransition& transition)優先順位順に状態遷移を登録します。
void setBehavior(const char* propertyName, const PropertyAnimation& animation)writeProperty() またはバインディング経由で @p propertyName が書き込まれた際に使用されるデフォルトアニメーションを設定します。明示的な StateTransition ルールが優先され、C++ のセッターを直接呼び出した場合はアニメーションしません。
void clearBehavior(const char* propertyName)今後のマネージド書き込みに使用するデフォルトアニメーションを削除します。
bool writeProperty(const char* propertyName, const QVariant& value)バインディングを削除せずに Behavior 経由でホストプロパティに書き込みます。
Qt 基底クラスドキュメント:QListView