Text fields
TagInput
Choose several values as compact tags with asynchronous suggestions and native text input.
Example

Usage
Select and remove tags
Choose a suggestion, then remove its tag with the mouse or keyboard.
#include <FluentQt/TextFields.h>
using namespace fluent::textfields;
auto* input = new fluent::textfields::TagInput(this);
input->setAccessibleName("Technologies");
input->setPlaceholderText("Choose a technology");
input->setSuggestions({"Qt", "C++", "Python"});
input->addItem("Qt", "Qt");
input->setMaximumWidth(360);import fluentqt
input = fluentqt.TagInput()
input.setAccessibleName("Technologies")
input.setObjectName("basicTagInput")
input.setPlaceholderText("Choose a technology")
input.setSuggestions(["Qt", "C++", "Python"])
input.addItem("Qt", "Qt")
input.setMaximumWidth(360)API
DeclarationNo matching API members.
fluent::textfields::TagInput
Inherits AutoSuggestBox
Compact selected tags around AutoSuggestBox's native text editor.
Constructors
Properties
QVariantList selectedItems- Read
selectedItems()WritesetSelectedItems()NotifyselectionChanged() int selectedCount- Read
selectedCount()NotifyselectionChanged()
Methods
void setSelectedItems(const QVariantList& items)Restores value snapshots; ignores malformed items and duplicate keys, preserving first occurrence.
bool addItem(const QString& key, const QString& text)Adds a value snapshot; returns false for empty or already-selected keys.
Signals
void tokensSubmitted(const QStringList& tokens)Asks the application to resolve submitted text or delimited pasted values.
Destructors
Subclass interfaces
Methods
Inherited from fluent::textfields::AutoSuggestBox
Properties
QStringList suggestionsSuggestion strings displayed by the suggestion popup.
Readsuggestions()WritesetSuggestions()NotifysuggestionsChanged()QString headerOptional label text displayed above the input row.
Readheader()WritesetHeader()NotifyheaderChanged()QString queryIconGlyphIcon glyph used by the query/search affordance.
ReadqueryIconGlyph()WritesetQueryIconGlyph()NotifyqueryIconGlyphChanged()bool queryIconVisibleWhether the query icon is visible.
ReadisQueryIconVisible()WritesetQueryIconVisible()NotifyqueryIconVisibleChanged()bool clearButtonEnabledControls the inline clear action independently of the query button.
ReadisClearButtonEnabled()WritesetClearButtonEnabled()NotifyclearButtonEnabledChanged()QueryButtonPlacement queryButtonPlacementPlacement of the query action button.
ReadqueryButtonPlacement()WritesetQueryButtonPlacement()NotifyqueryButtonPlacementChanged()int inputHeightPreferred height of the input surface.
ReadinputHeight()WritesetInputHeight()NotifyinputHeightChanged()int queryButtonSizeSize of the query action button.
ReadqueryButtonSize()WritesetQueryButtonSize()NotifyqueryButtonSizeChanged()int clearButtonSizeSize of the clear button.
ReadclearButtonSize()WritesetClearButtonSize()NotifyclearButtonSizeChanged()Typography::FontRole suggestionFontRoleTypography role used by suggestion rows.
ReadsuggestionFontRole()WritesetSuggestionFontRole()NotifysuggestionFontRoleChanged()int suggestionItemHeightHeight of each suggestion row.
ReadsuggestionItemHeight()WritesetSuggestionItemHeight()NotifysuggestionItemHeightChanged()bool isSuggestionListOpenWhether the suggestion popup is open.
ReadisSuggestionListOpen()NotifysuggestionListOpenChanged()QAbstractItemModel* suggestionModel- Read
suggestionModel()WritesetSuggestionModel()NotifysuggestionModelChanged() int suggestionCount- Read
suggestionCount()NotifysuggestionCountChanged() bool asyncSuggestionsEnabled- Read
isAsyncSuggestionsEnabled()WritesetAsyncSuggestionsEnabled()NotifyasyncSuggestionsEnabledChanged() int debounceInterval- Read
debounceInterval()WritesetDebounceInterval()NotifydebounceIntervalChanged() LoadState loadState- Read
loadState()NotifyloadStateChanged() bool hasMoreSuggestions- Read
hasMoreSuggestions()NotifyhasMoreSuggestionsChanged() QString loadingText- Read
loadingText()WritesetLoadingText()NotifyloadingTextChanged() QString emptyText- Read
emptyText()WritesetEmptyText()NotifyemptyTextChanged() QString emptyDescription- Read
emptyDescription()WritesetEmptyDescription()NotifyemptyDescriptionChanged() QString loadingMoreTextText shown while another result page is loading.
ReadloadingMoreText()WritesetLoadingMoreText()NotifyloadingMoreTextChanged()QString moreResultsTextText accompanying the action for another result page.
ReadmoreResultsText()WritesetMoreResultsText()NotifymoreResultsTextChanged()QString retryTextCaption of the retry action after a failed request.
ReadretryText()WritesetRetryText()NotifyretryTextChanged()QString loadMoreTextCaption of the action that requests another result page.
ReadloadMoreText()WritesetLoadMoreText()NotifyloadMoreTextChanged()
Methods
QStringList suggestions() constSuggestion strings displayed by the suggestion popup.
QString header() constOptional label text displayed above the input row.
QString queryIconGlyph() constIcon glyph used by the query/search affordance.
bool isQueryIconVisible() constWhether the query icon is visible.
bool isClearButtonEnabled() constControls the inline clear action independently of the query button.
void setClearButtonEnabled(bool enabled)Controls the inline clear action independently of the query button.
QueryButtonPlacement queryButtonPlacement() constPlacement of the query action button.
int inputHeight() constPreferred height of the input surface.
int queryButtonSize() constSize of the query action button.
int clearButtonSize() constSize of the clear button.
Typography::FontRole suggestionFontRole() constTypography role used by suggestion rows.
int suggestionItemHeight() constHeight of each suggestion row.
bool isSuggestionListOpen() constWhether the suggestion popup is open.
void setSuggestionModel(QAbstractItemModel* model)Borrows a flat model using column zero, DisplayRole and optional UserRole payloads.
QString loadingMoreText() constText shown while another result page is loading.
void setLoadingMoreText(const QString& text)Text shown while another result page is loading.
QString moreResultsText() constText accompanying the action for another result page.
void setMoreResultsText(const QString& text)Text accompanying the action for another result page.
QString retryText() constCaption of the retry action after a failed request.
void setRetryText(const QString& text)Caption of the retry action after a failed request.
QString loadMoreText() constCaption of the action that requests another result page.
void setLoadMoreText(const QString& text)Caption of the action that requests another result page.
bool isSuggestionRequestCurrent(quint64 requestId) constTests a request token before the application changes its borrowed model.
bool completeSuggestionRequest(quint64 requestId, bool hasMore = false)Finishes a current request after guarded application model updates.
bool setSuggestionsForRequest(quint64 requestId, const QStringList& suggestions, bool hasMore = false)Accepts current string results, appending only for a load-more request.
bool failSuggestionRequest(quint64 requestId, const QString& message, const QString& details = QString())Shows a current request failure; pagination failures retain existing rows.
void setHeader(const QString& header)Optional label text displayed above the input row.
void setQueryIconGlyph(const QString& glyph)Icon glyph used by the query/search affordance.
void setQueryIconVisible(bool visible)Whether the query icon is visible.
void setQueryButtonPlacement(QueryButtonPlacement placement)Placement of the query action button.
void setInputHeight(int height)Preferred height of the input surface.
void setQueryButtonSize(int size)Size of the query action button.
void setClearButtonSize(int size)Size of the clear button.
void setSuggestionFontRole(Typography::FontRole role)Typography role used by suggestion rows.
void setSuggestionItemHeight(int height)Height of each suggestion row.
void setSuggestions(const QStringList& suggestions)Suggestion strings displayed by the suggestion popup.
void requestSuggestions()Immediately requests the current query when asynchronous suggestions are enabled.
Signals
void suggestionsChanged()Suggestion strings displayed by the suggestion popup.
void headerChanged()Optional label text displayed above the input row.
void queryIconGlyphChanged()Icon glyph used by the query/search affordance.
void queryIconVisibleChanged()Whether the query icon is visible.
void queryButtonPlacementChanged()Placement of the query action button.
void inputHeightChanged()Preferred height of the input surface.
void queryButtonSizeChanged()Size of the query action button.
void suggestionFontRoleChanged()Typography role used by suggestion rows.
void suggestionItemHeightChanged()Height of each suggestion row.
void suggestionListOpenChanged(bool open)Whether the suggestion popup is open.
void loadingMoreTextChanged()Text shown while another result page is loading.
void moreResultsTextChanged()Text accompanying the action for another result page.
void retryTextChanged()Caption of the retry action after a failed request.
void loadMoreTextChanged()Caption of the action that requests another result page.
void suggestionsRequested(const QString& query, quint64 requestId, bool append)Requests application data; append is true only for pagination or its retry.
void suggestionRequestCanceled(quint64 requestId)Asks the application to cancel transport work for an invalidated token.
Enumerations
enum class TextChangeReasonUserInputProgrammaticChangeSuggestionChosen
enum class QueryButtonPlacementRightLeftLeadingTrailing
enum class LoadStateState of the current asynchronous query; Ready may contain no rows.
IdleLoadingReadyFailed
Inherited from fluent::textfields::LineEdit
Properties
QMargins contentMarginsContent margins whose horizontal values include Qt's internal text inset.
ReadcontentMargins()WritesetContentMargins()NotifycontentMarginsChanged()Typography::FontRole fontRoleFluent typography role used for text rendering.
ReadfontRole()WritesetFontRole()NotifyfontRoleChanged()bool clearButtonEnabledWhether the trailing clear button is enabled.
ReadisClearButtonEnabled()WritesetClearButtonEnabled()NotifyclearButtonEnabledChanged()int clearButtonSizeSize of the clear button, defaulting to 24 logical pixels.
ReadclearButtonSize()WritesetClearButtonSize()NotifyclearButtonSizeChanged()QPoint clearButtonOffsetPixel offset applied to the clear button.
ReadclearButtonOffset()WritesetClearButtonOffset()NotifyclearButtonOffsetChanged()int focusedBorderWidthBottom border width while focused.
ReadfocusedBorderWidth()WritesetFocusedBorderWidth()NotifyfocusedBorderWidthChanged()int unfocusedBorderWidthBottom border width while not focused.
ReadunfocusedBorderWidth()WritesetUnfocusedBorderWidth()NotifyunfocusedBorderWidthChanged()bool frameVisibleWhether LineEdit paints its input frame and focus underline.
ReadisFrameVisible()WritesetFrameVisible()NotifyframeVisibleChanged()QString trailingText- Read
trailingText()WritesetTrailingText()NotifytrailingTextChanged() QWidget* trailingWidget- Read
trailingWidget()NotifytrailingWidgetChanged() fluent::WidgetOwnership trailingWidgetOwnership- Read
trailingWidgetOwnership()NotifytrailingWidgetOwnershipChanged() QString clearButtonAccessibleName- Read
clearButtonAccessibleName()WritesetClearButtonAccessibleName()NotifyclearButtonAccessibleNameChanged() Qt::FocusPolicy clearButtonFocusPolicy- Read
clearButtonFocusPolicy()WritesetClearButtonFocusPolicy()NotifyclearButtonFocusPolicyChanged()
Methods
QMargins contentMargins() constContent margins whose horizontal values include Qt's internal text inset.
void setContentMargins(const QMargins& margins)Content margins whose horizontal values include Qt's internal text inset.
Typography::FontRole fontRole() constFluent typography role used for text rendering.
void setFontRole(Typography::FontRole role)Fluent typography role used for text rendering.
bool isClearButtonEnabled() constWhether the trailing clear button is enabled.
void setClearButtonEnabled(bool enabled)Whether the trailing clear button is enabled.
int clearButtonSize() constSize of the clear button, defaulting to 24 logical pixels.
void setClearButtonSize(int size)Size of the clear button, defaulting to 24 logical pixels.
QPoint clearButtonOffset() constPixel offset applied to the clear button.
void setClearButtonOffset(const QPoint& offset)Pixel offset applied to the clear button.
int focusedBorderWidth() constBottom border width while focused.
void setFocusedBorderWidth(int width)Bottom border width while focused.
int unfocusedBorderWidth() constBottom border width while not focused.
void setUnfocusedBorderWidth(int width)Bottom border width while not focused.
bool isFrameVisible() constWhether LineEdit paints its input frame and focus underline.
void setFrameVisible(bool visible)Whether LineEdit paints its input frame and focus underline.
void setTrailingText(const QString& text)Displays a plain-text suffix without changing the editable value; replaces hosted content.
bool setTrailingWidget(QWidget* widget, WidgetOwnership ownership)Hosts one trailing widget using explicit ownership; rejects the host and its ancestors.
QWidget* takeTrailingWidget()Detaches the custom trailing widget and transfers it to the caller.
void releaseTrailingWidget()Releases custom trailing content according to its recorded ownership policy.
Signals
void contentMarginsChanged()Content margins whose horizontal values include Qt's internal text inset.
void fontRoleChanged()Fluent typography role used for text rendering.
void clearButtonEnabledChanged()Whether the trailing clear button is enabled.
void clearButtonSizeChanged()Size of the clear button, defaulting to 24 logical pixels.
void clearButtonOffsetChanged()Pixel offset applied to the clear button.
void focusedBorderWidthChanged()Bottom border width while focused.
void unfocusedBorderWidthChanged()Bottom border width while not focused.
void frameVisibleChanged()Whether LineEdit paints its input frame and focus underline.
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:QLineEdit