基本入力
MultiSelectComboBox 複数選択コンボボックス
複数の項目を選択できる検索可能なドロップダウンリストです。
サンプル
プロパティプレビューを読み込めませんでした。もう一度「プロパティプレビュー」を選択して再試行してください。

使い方
複数のモデル行を選択
setModel() で選択肢を提供し、setSelectedRows() で初期選択を設定します。項目の切り替え中もドロップダウンは開いたままになり、selectionChanged 時に selectedIndexes() で選択項目を読み取れます。maximumVisibleItems は表示行数の上限を設定し、それ以上の項目はスクロール可能になります。
#include <FluentQt/BasicInput.h>
using namespace fluent::basicinput;
auto* model = new QStringListModel(
{"Design", "Engineering", "Research", "Support"}, this);
auto* box = new MultiSelectComboBox(this);
box->setModel(model);
box->setPlaceholderText("Choose teams");
box->setAccessibleName("Teams");
box->setSelectedRows({0, 2});
box->setFixedWidth(280);
auto* status = new Label(this);
status->setFixedWidth(280);
status->setWordWrap(true);
auto updateStatus = [box, status] {
QStringList labels;
for (const QModelIndex& index : box->selectedIndexes())
labels << index.data().toString();
status->setText(QStringLiteral("Selected: %1")
.arg(labels.join(", ")));
};
connect(box, &MultiSelectComboBox::selectionChanged,
this, [=] { updateStatus(); });
updateStatus();import fluentqt
from PySide6.QtCore import QStringListModel
model = QStringListModel(
['Design', 'Engineering', 'Research', 'Support'],
root
)
box = fluentqt.MultiSelectComboBox()
box.setModel(model)
box.setPlaceholderText('Choose teams')
box.setAccessibleName('Teams')
box.setSelectedRows([0, 2])
box.setFixedWidth(280)
status = fluentqt.Label()
status.setFixedWidth(280)
status.setWordWrap(True)
def update_status(*_args):
labels = [index.data() for index in box.selectedIndexes()]
status.setText(f"Selected: {', '.join(labels)}")
box.selectionChanged.connect(update_status)API
宣言を表示一致する API メンバーはありません。
fluent::basicinput::MultiSelectComboBox
継承元 QWidget · FluentElement · QMLPlus
複数行を選択できるモデル駆動の Fluent ドロップダウンです。既定では内蔵の QItemSelectionModel を使用し、外部のデータモデルおよび選択モデルは呼び出し側で管理されます。
コンストラクタ
デストラクタ
メソッド
QAbstractItemModel* model() constドロップダウンの選択肢を提供するソースモデル。
void setModel(QAbstractItemModel* model)ソースモデルを設定します(呼び出し元で管理され、このコントロールによって破棄されません)。
QItemSelectionModel* selectionModel() constチェックされた行を保持する選択モデルです(デフォルトでは内部モデルを使用します)。
void setSelectionModel(QItemSelectionModel* selectionModel)カスタム選択モデルを設定します(呼び出し元で管理され、このコントロールによって破棄されません)。
int modelColumn() constラベル表示およびフィルタリングに使用されるソースモデルの列。
void setModelColumn(int column)ラベル表示およびフィルタリングに使用されるソースモデルの列。
QModelIndex rootModelIndex() const直下の子項目が選択肢リストを構成するソースモデルのルート。
void setRootModelIndex(const QModelIndex& index)直下の子項目が選択肢リストを構成するソースモデルのルート。
QString placeholderText() const選択可能な行が選択されていないときに表示されるテキストです。
void setPlaceholderText(const QString& text)選択可能な行が選択されていないときに表示されるテキストです。
bool isSearchEnabled() constポップアップ内にローカルの部分一致検索フィールドを表示するかどうかです。
void setSearchEnabled(bool enabled)ポップアップ内にローカルの部分一致検索フィールドを表示するかどうかです。
QString searchPlaceholderText() constポップアップ検索フィールドで使用されるプレースホルダーテキスト。
void setSearchPlaceholderText(const QString& text)ポップアップ検索フィールドで使用されるプレースホルダーテキスト。
bool isSelectAllVisible() constポップアップに3状態のすべて選択アクションを表示するかどうか。
void setSelectAllVisible(bool visible)ポップアップに3状態のすべて選択アクションを表示するかどうか。
int maximumVisibleItems() constスクロールなしで表示される選択肢の最大行数。
void setMaximumVisibleItems(int count)スクロールなしで表示される選択肢の最大行数。
bool isOpen() constポップアップの論理的な開状態。
int selectedCount() constrootModelIndex 配下で選択されている選択可能行数。
void setSelectedRows(const QList<int>& rows)アクティブなルート配下の選択行を置き換えます。
void clearSelection()アクティブなルート配下の選択行をクリアします。
void selectAll()ルート配下のすべての有効かつ選択可能なソース行を選択します。
void open()アンカーされたドロップダウンを開きます。
void close()現在の選択を保持したままドロップダウンを閉じます。
void setIsOpen(bool open)ポップアップの論理的な開状態。
プロパティ
QAbstractItemModel* modelドロップダウンの選択肢を提供するソースモデル。
読み取りmodel()書き込みsetModel()通知シグナルmodelChanged()QItemSelectionModel* selectionModelチェックされた行を保持する選択モデルです(デフォルトでは内部モデルを使用します)。
読み取りselectionModel()書き込みsetSelectionModel()通知シグナルselectionModelChanged()int modelColumnラベル表示およびフィルタリングに使用されるソースモデルの列。
読み取りmodelColumn()書き込みsetModelColumn()通知シグナルmodelColumnChanged()QModelIndex rootModelIndex直下の子項目が選択肢リストを構成するソースモデルのルート。
読み取りrootModelIndex()書き込みsetRootModelIndex()通知シグナルrootModelIndexChanged()QString placeholderText選択可能な行が選択されていないときに表示されるテキストです。
読み取りplaceholderText()書き込みsetPlaceholderText()通知シグナルplaceholderTextChanged()bool searchEnabledポップアップ内にローカルの部分一致検索フィールドを表示するかどうかです。
読み取りisSearchEnabled()書き込みsetSearchEnabled()通知シグナルsearchEnabledChanged()QString searchPlaceholderTextポップアップ検索フィールドで使用されるプレースホルダーテキスト。
読み取りsearchPlaceholderText()書き込みsetSearchPlaceholderText()通知シグナルsearchPlaceholderTextChanged()bool selectAllVisibleポップアップに3状態のすべて選択アクションを表示するかどうか。
読み取りisSelectAllVisible()書き込みsetSelectAllVisible()通知シグナルselectAllVisibleChanged()int maximumVisibleItemsスクロールなしで表示される選択肢の最大行数。
読み取りmaximumVisibleItems()書き込みsetMaximumVisibleItems()通知シグナルmaximumVisibleItemsChanged()bool isOpenポップアップの論理的な開状態。
読み取りisOpen()書き込みsetIsOpen()通知シグナルisOpenChanged()int selectedCountrootModelIndex 配下で選択されている選択可能行数。
読み取りselectedCount()通知シグナルselectedCountChanged()
シグナル
void modelChanged(QAbstractItemModel* model)ドロップダウンの選択肢を提供するソースモデル。
void selectionModelChanged(QItemSelectionModel* selectionModel)チェックされた行を保持する選択モデルです(デフォルトでは内部モデルを使用します)。
void modelColumnChanged(int column)ラベル表示およびフィルタリングに使用されるソースモデルの列。
void rootModelIndexChanged(const QModelIndex& index)直下の子項目が選択肢リストを構成するソースモデルのルート。
void selectedCountChanged(int count)rootModelIndex 配下で選択されている選択可能行数。
void placeholderTextChanged(const QString& text)選択可能な行が選択されていないときに表示されるテキストです。
void searchEnabledChanged(bool enabled)ポップアップ内にローカルの部分一致検索フィールドを表示するかどうかです。
void searchPlaceholderTextChanged(const QString& text)ポップアップ検索フィールドで使用されるプレースホルダーテキスト。
void selectAllVisibleChanged(bool visible)ポップアップに3状態のすべて選択アクションを表示するかどうか。
void maximumVisibleItemsChanged(int count)スクロールなしで表示される選択肢の最大行数。
void isOpenChanged(bool open)ポップアップの論理的な開状態。
protected メンバー
メソッド
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 基底クラスドキュメント:QWidget