QmlMaterial 0.1.0
|
#include <qml_material/kirigami/toolbarlayout.h>
Public Types | |
enum | HeightMode { AlwaysCenter , AlwaysFill , ConstrainIfLarger } |
Public Member Functions | |
void | addAction (QObject *action) |
void | removeAction (QObject *action) |
void | clearActions () |
Q_SLOT void | relayout () |
Properties | |
QQmlListProperty< QObject > | actions |
QList< QObject * > | hiddenActions |
QQmlComponent * | fullDelegate |
QQmlComponent * | iconDelegate |
QQmlComponent * | separatorDelegate |
QQmlComponent * | moreButton |
qreal | spacing |
Qt::Alignment | alignment |
qreal | visibleWidth |
qreal | minimumWidth |
Qt::LayoutDirection | layoutDirection |
HeightMode | heightMode |
An item that creates delegates for actions and lays them out in a row.
This effectively combines RowLayout and Repeater in a single item, with the addition of some extra performance enhancing tweaks. It will create instances of fullDelegate and ::itemDelegate for each action in actions . These are then positioned horizontally. Any action that ends up being placed outside the width of the item is hidden and will be part of hiddenActions.
The items created as delegates are always created asynchronously, to avoid creation lag spikes. Each delegate has access to the action it was created for through the ToolBarLayoutAttached attached property.
An enum describing several modes that can be used to deal with items with a height that does not match the toolbar's height.
void ToolBarLayout::addAction | ( | QObject * | action | ) |
Add an action to the list of actions.
action | The action to add. |
void ToolBarLayout::clearActions | ( | ) |
Clear the list of actions.
void ToolBarLayout::relayout | ( | ) |
Queue a relayout of this layout.
void ToolBarLayout::removeAction | ( | QObject * | action | ) |
Remove an action from the list of actions.
action | The action to remove. |
|
read |
The actions this layout should create delegates for.
|
readwrite |
How to align the delegates within this layout.
When there is more space available than required by the visible delegates, we need to determine how to place the delegates. This property determines how to do that. Note that the moreButton, if visible, will always be placed at the end of the layout.
|
readwrite |
A component that is used to create full-size delegates from.
Each delegate has three states, it can be full-size, icon-only or hidden. By default, the full-size delegate is used. When the action has the DisplayHint::IconOnly hint set, it will always use the iconDelegate. When it has the DisplayHint::KeepVisible hint set, it will use the full-size delegate when it fits. If not, it will use the iconDelegate, unless even that does not fit, in which case it will still be hidden.
|
readwrite |
How to handle items that do not match the toolbar's height.
When toolbar items do not match the height of the toolbar, there are several ways we can deal with this. This property sets the preferred way.
The default is HeightMode::ConstrainIfLarger .
|
read |
A list of actions that do not fit in the current view and are thus hidden.
|
readwrite |
A component that is used to create icon-only delegates from.
|
readwrite |
Which direction to layout in.
This is primarily intended to support right-to-left layouts. When set to LeftToRight, delegates will be layout with the first item on the left and following items to the right of that. The more button will be placed at the rightmost position. Alignment flags work normally.
When set to RightToLeft, delegates will be layout with the first item on the right and following items to the left of that. The more button will be placed at the leftmost position. Alignment flags are inverted, so AlignLeft will align items to the right, and vice-versa.
|
read |
The minimum width this layout can have.
This is equal to the width of the moreButton.
|
readwrite |
A component that is used to create the "more button" item from.
The more button is shown when there are actions that do not fit the current view. It is intended to have functionality to show these hidden actions, like popup a menu with them showing.
|
readwrite |
A component that is used to create separator delegates from.
|
readwrite |
The amount of spacing between individual delegates.
|
read |
The combined width of visible delegates in this layout.