ItemSelectionModel QML Type

QAbstractItemModel およびそれをサポートするビューと組み合わせて使用するQItemSelectionModel をインスタンス化します。詳細...

Import Statement: import QtQml.Models
In C++: QItemSelectionModel

プロパティ

信号

方法

詳細説明

Qt QuickQItemSelectionModel およびモデルとビューも参照してください

プロパティの説明

currentIndex : QModelIndex [read-only]

値を設定するにはsetCurrentIndex() を使用します。

setCurrentIndex() およびcurrentChanged()も参照して ください。


hasSelection : bool [read-only]

値が変更されていなくても、selectionChanged() が発行されるたびに、プロパティ・バインディングの更新がトリガされます。

selectionselectedIndexesselect ()、selectionChanged ()も参照


model : QAbstractItemModel

このプロパティの値は、ビューのモデルと一致する必要があります。


selectedIndexes : list<var> [read-only]

選択モデル内のすべてのインデックス(QModelIndex インスタンス)のリストを含みます。

QModelIndexList 型も参照してください


selection : object [read-only]

選択モデルに格納されている選択範囲を保持する。


シグナル

currentChanged(QModelIndex current, QModelIndex previous)

このシグナルは、現在のアイテムが変更されるたびに発行される。previous モデルのアイテムインデックスは、current のインデックスに置き換えられます。

アイテムモデルがリセットされると、このシグナルは発行されないことに注意してください。

注: 対応するハンドラはonCurrentChanged です。

currentIndexsetCurrentIndex()、selectionChanged()も参照してください


selectionChanged(QItemSelection selected, QItemSelection deselected)

このシグナルは、選択範囲が変更されるたびに発行されます。選択範囲の変更は、deselected 項目の項目選択とselected 項目の項目選択として表現されます。

現在のインデックスは選択範囲とは無関係に変化することに注意してください。また、アイテムモデルがリセットされると、このシグナルは発行されないことにも注意してください。

注: 対応するハンドラはonSelectionChanged です。

select() およびcurrentChanged()も参照して ください。


メソッドの説明

void clear()

選択モデルをクリアします。selectionChanged() およびcurrentChanged() を発行します。


void clearCurrentIndex()

現在のインデックスをクリアします。currentChanged() を実行します。


void clearSelection()

選択モデルの選択範囲をクリアします。selectionChanged() を発行します。


bool columnIntersectsSelection(int column, QModelIndex parent)

指定されたparent を持つcolumn で選択されている項目がある場合は、true を返します。


bool isColumnSelected(int column, QModelIndex parent)

与えられたparent を持つcolumn ですべての項目が選択されている場合はtrue を返します。

この関数は、通常、同じ列のすべての項目に対してisSelected() を呼び出すよりも高速であり、選択不可能な項目は無視されることに注意。


bool isRowSelected(int row, QModelIndex parent)

与えられたparent を持つrow ですべての項目が選択されている場合、true を返す。

この関数は通常、同じ行のすべての項目に対してisSelected() を呼び出すよりも高速であり、選択不可能な項目は無視されることに注意。


bool isSelected(QModelIndex index)

与えられたモデル項目index が選択されている場合、true を返します。


void reset()

選択モデルをクリアします。シグナルは発しません。


bool rowIntersectsSelection(int row, QModelIndex parent)

与えられたparentrow に選択されている項目があればtrue を返します。


void select(QItemSelection selection, SelectionFlags command)

指定されたcommand を使って項目selection を選択し、selectionChanged() を発する。

有効なcommand の値は select(index, command).


void select(QModelIndex index, SelectionFlags command)

指定されたcommand を使用してモデル項目index を選択し、selectionChanged() を出力する。

command パラメータの有効な値は以下のとおりです:

定数説明
NoUpdate選択は行われない。
Clear完全な選択はクリアされます。
Select指定されたすべてのインデックスが選択される。
Deselect指定されたすべてのインデックスが選択解除されます。
Toggle指定されたすべてのインデックスが現在の状態に応じて選択または選択解除されます。
Current現在の選択範囲が更新される。
Rowsすべてのインデックスが行にまたがって展開されます。
Columnsすべてのインデックスが列をまたぐように展開される。
SelectCurrentSelectとCurrentの組み合わせ。
ToggleCurrentToggleとCurrentの組み合わせ。
ClearAndSelectClear と Select の組み合わせ。

list<var> selectedColumns(int row)

すべての行が選択されている列について、与えられたrow のインデックス(QModelIndex インスタンスのリスト)を返す。

selectedRows() およびQModelIndexList Typeも参照してください


list<var> selectedRows(int column)

すべての列が選択されている行について、与えられたcolumn 内のインデックス (QModelIndex インスタンスのリスト) を返します。

selectedColumns() およびQModelIndexList Typeも参照してください


void setCurrentIndex(QModelIndex index, SelectionFlags command)

モデル項目index を現在の項目に設定し、currentChanged() を発行します。カレント項目は、キーボード・ナビゲーションとフォーカス表示に使用されます。カレント項目は、選択された項目とは独立していますが、選択された項目がカレント項目になることもあります。

指定されたcommandindex は、現在の選択項目の一部となることもできます。

有効なcommand の値は select(index, command).

select()も参照


© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.