Icon-and-text sidebar navigation widget backed by QStandardItemModel.
More...
#include <sidebarwidget.h>
|
| void | itemClicked (int entityType) |
| | Emitted when the user clicks a sidebar entry.
|
| |
|
| | SidebarWidget (QWidget *parent=nullptr) |
| | Construct with an optional parent.
|
| |
| void | addItem (int entityMetadataType, const QString &text, int imageResourceId=0) |
| | Add an entry to the sidebar.
|
| |
| void | removeItem (int entityMetadataType) |
| | Remove the entry with the given entity type.
|
| |
| bool | containsItem (int entityMetadataType) const |
| | Return whether an entry with the given entity type exists.
|
| |
|
void | clear () |
| | Remove all entries from the sidebar.
|
| |
| void | selectItem (int entityMetadataType) |
| | Programmatically select the entry with the given entity type.
|
| |
| QMargins | contentsMargins () const |
| | Return the content margins used by the paint delegate.
|
| |
| void | setContentsMargins (const QMargins &value) |
| | Set the content margins used by the paint delegate.
|
| |
| int | horizontalSpacing () const |
| | Return the horizontal spacing between the icon and text.
|
| |
| void | setHorizontalSpacing (int value) |
| | Set the horizontal spacing between the icon and text.
|
| |
| int | verticalSpacing () const |
| | Return the vertical spacing between entries.
|
| |
| void | setVerticalSpacing (int value) |
| | Set the vertical spacing between entries.
|
| |
| QSize | iconSize () const |
| | Return the icon size used when rendering entries.
|
| |
| void | setIconSize (const QSize &value) |
| | Set the icon size used when rendering entries.
|
| |
Icon-and-text sidebar navigation widget backed by QStandardItemModel.
SidebarWidget displays a vertical list of named, optionally-iconed navigation entries. Each entry is keyed by an entity metadata type integer. Clicking an entry emits itemClicked() with the entity type. Spacing, icon size, and content margins are all adjustable.
Definition at line 19 of file sidebarwidget.h.
◆ SidebarWidget()
| SidebarWidget::SidebarWidget |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
Construct with an optional parent.
- Parameters
-
| parent | Optional QWidget parent |
◆ addItem()
| void SidebarWidget::addItem |
( |
int |
entityMetadataType, |
|
|
const QString & |
text, |
|
|
int |
imageResourceId = 0 |
|
) |
| |
Add an entry to the sidebar.
- Parameters
-
| entityMetadataType | Integer key for the entry |
| text | Display text |
| imageResourceId | Optional Qt resource ID for the entry icon (0 = none) |
◆ containsItem()
| bool SidebarWidget::containsItem |
( |
int |
entityMetadataType | ) |
const |
Return whether an entry with the given entity type exists.
- Parameters
-
| entityMetadataType | Entity type key to check |
- Returns
- true if the entry is present
◆ contentsMargins()
| QMargins SidebarWidget::contentsMargins |
( |
| ) |
const |
Return the content margins used by the paint delegate.
- Returns
- Content margins
◆ horizontalSpacing()
| int SidebarWidget::horizontalSpacing |
( |
| ) |
const |
Return the horizontal spacing between the icon and text.
- Returns
- Horizontal spacing in pixels
◆ iconSize()
| QSize SidebarWidget::iconSize |
( |
| ) |
const |
Return the icon size used when rendering entries.
- Returns
- Icon size
◆ itemClicked
| void SidebarWidget::itemClicked |
( |
int |
entityType | ) |
|
|
signal |
Emitted when the user clicks a sidebar entry.
- Parameters
-
| entityType | Entity type key of the clicked entry |
◆ removeItem()
| void SidebarWidget::removeItem |
( |
int |
entityMetadataType | ) |
|
Remove the entry with the given entity type.
- Parameters
-
| entityMetadataType | Entity type key of the entry to remove |
◆ selectItem()
| void SidebarWidget::selectItem |
( |
int |
entityMetadataType | ) |
|
Programmatically select the entry with the given entity type.
- Parameters
-
| entityMetadataType | Entity type key to select |
◆ setContentsMargins()
| void SidebarWidget::setContentsMargins |
( |
const QMargins & |
value | ) |
|
Set the content margins used by the paint delegate.
- Parameters
-
◆ setHorizontalSpacing()
| void SidebarWidget::setHorizontalSpacing |
( |
int |
value | ) |
|
Set the horizontal spacing between the icon and text.
- Parameters
-
| value | Horizontal spacing in pixels |
◆ setIconSize()
| void SidebarWidget::setIconSize |
( |
const QSize & |
value | ) |
|
Set the icon size used when rendering entries.
- Parameters
-
◆ setVerticalSpacing()
| void SidebarWidget::setVerticalSpacing |
( |
int |
value | ) |
|
Set the vertical spacing between entries.
- Parameters
-
| value | Vertical spacing in pixels |
◆ verticalSpacing()
| int SidebarWidget::verticalSpacing |
( |
| ) |
const |
Return the vertical spacing between entries.
- Returns
- Vertical spacing in pixels
The documentation for this class was generated from the following file: