ToolActions

Search for usage in LXR

ToolActions Class Reference
Inheritance diagram for ToolActions:

Properties

list< Actionactions
 
bool autoExclusive
 
bool canCyclic
 
bool checkable
 
int count
 
bool cyclic
 
string defaultIconName
 
int display
 
bool expanded
 
bool flat
 

Public Member Functions

void uncheck (except)
 

Detailed Description

A set of grouped action visually joined together.

This control inherits from QQC2 Control, to checkout its inherited properties refer to the Qt Docs.

The set actions can be checkable and auto-exclusive or not.

[1] Non-checkable. [2] Checkable non-auto-exclusive. [3] Checkable and autoexclusive

Features

This control supports checkable and non-checkable actions. Also auto-exclusive and non-auto-exclusive actions.

When enabling the autoExclusive property, then only one action in the group can be marked as checked at the time.

There is also the option to collapse the actions into a single button with a popup menu where the actions are listed, this is useful when the available space changes and the control needs to be made more compact to save space.

The collapsed actions into a menu

If only two actions are added and marked as auto-exclusive, then this control has the option to enable a cyclic behavior, which means that toggling one button will activate the next action in line and cyclic around.

See also
canCyclic
cyclic

Heres a example of how to achieve such behavior:

Maui.ToolActions
{
id: _actions
checkable: true
cyclic: true //enable the cyclic behavior
expanded: false //the cyclic behavior needs to be in the collapsed mode
property int currentAction: 0 //here we keep the state for the current action checked
{
id: _action1
icon.name: "view-list-details"
checked: _actions.currentAction === 0
onTriggered:
{
_actions.currentAction = 0
}
}
{
id: _action2
icon.name: "view-list-icons"
checked: _actions.currentAction === 1
onTriggered:
{
_actions.currentAction = 1
}
}
}
bool checkable
Whether the action button can be checked.
bool autoExclusive
Whether this control should only allow one action to be checked at the time.
bool cyclic
Whether two actions can be triggered in a cyclic manner.
bool expanded
Whether the control should display all the actions as buttons in a row, or to collapse them into a po...
Maui.ToolActions
{
checkable: true
{
text: "Pick"
}
{
text: "Only"
}
{
text: "One"
}
}

You can find a more complete example at this link.

Definition at line 90 of file ToolActions.qml.

Property Documentation

◆ actions

list<Action> ToolActions::actions
read

The list of QQC2 Action to be listed.

These can be declared a children elements of this control.

Remarks
This is the default property

Definition at line 103 of file ToolActions.qml.

◆ autoExclusive

bool ToolActions::autoExclusive
read

Whether this control should only allow one action to be checked at the time.

By default this is set to true

Definition at line 108 of file ToolActions.qml.

◆ canCyclic

bool ToolActions::canCyclic
read

Whether the cyclic behavior can be activated.

For it to be possible, the conditions are: only two actions and those must be auto-exclusive.

See also
cyclic
autoExclusive
count
Remarks
This property is read-only

Definition at line 139 of file ToolActions.qml.

◆ checkable

bool ToolActions::checkable
read

Whether the action button can be checked.

If enabled, then the state will be styled accordingly. @By default this is set to true.

Definition at line 113 of file ToolActions.qml.

◆ count

int ToolActions::count
read

The total amount of actions declared.

Remarks
This property is read-only

Definition at line 149 of file ToolActions.qml.

◆ cyclic

bool ToolActions::cyclic
read

Whether two actions can be triggered in a cyclic manner.

So one press will activate the next action and then cycle around to the first one again.

Note
For this to work only two actions can be added
See also
canCyclic By default this is set to false

Definition at line 130 of file ToolActions.qml.

◆ defaultIconName

string ToolActions::defaultIconName
read

The icon name to be used in the button that opens the menu popup, when the view is collapsed.

By default this is set to application-menu.

Definition at line 159 of file ToolActions.qml.

◆ display

int ToolActions::display
read

Options on how to display the button text and icon.

Available options are:

  • ToolButton.IconOnly
  • ToolButton.TextBesideIcon
  • ToolButton.TextOnly
  • ToolButton.TextUnderIcon By default this is set to ToolButton.TextBesideIcon

Definition at line 123 of file ToolActions.qml.

◆ expanded

bool ToolActions::expanded
read

Whether the control should display all the actions as buttons in a row, or to collapse them into a popup menu.

By default this is set to true.

Definition at line 154 of file ToolActions.qml.

◆ flat

bool ToolActions::flat
read

Whether the style of this control should be styled as flat.

By default this is set to false.

Definition at line 144 of file ToolActions.qml.

Member Function Documentation

◆ uncheck()

void ToolActions::uncheck ( except )

Forces to uncheck all the actions except the one action sent as the argument.

Parameters
exceptthe action that should not be unchecked.

The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:06:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.