Open 3D Engine AzQtComponents API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzQtComponents::BreadCrumbs Class Reference

#include <BreadCrumbs.h>

Inherits QFrame.

Classes

struct  Config
 Style configuration for the Breadcrumbs class. More...
 

Public Slots

void pushPath (const QString &fullPath)
 Pushes a path to be shown in the Breadcrumbs widget.
 
void pushFullPath (const QString &newFullPath, const QString &newPath)
 
bool back ()
 Restores the previous breadcrumb path from the navigation stack if it exists.
 
bool forward ()
 Restores the next breadcrumb path from the navigation stack if it exists.
 
void startEditing ()
 

Signals

void pathChanged (const QString &fullPath)
 
void pathEdited (const QString &requestedPath)
 
void linkClicked (const QString &linkPath, int linkIndex)
 
void backAvailabilityChanged (bool enabled)
 
void forwardAvailabilityChanged (bool enabled)
 

Public Member Functions

 BreadCrumbs (QWidget *parent=nullptr)
 
bool isBackAvailable () const
 Returns true if it is possible to move back in the navigation stack, false otherwise.
 
bool isForwardAvailable () const
 Returns true if it is possible to move forward in the navigation stack, false otherwise.
 
bool isUpAvailable () const
 Returns true if the current breadcrumb path has a parent that can be added to the navigation stack, false otherwise.
 
QString currentPath () const
 Returns a string with the current breadcrumb path.
 
QString fullPath () const
 Returns the full path if the current path is not the full path.
 
void setCurrentPath (const QString &newPath)
 Sets the current breadcrumb path without updating the navigation stack.
 
void setDefaultIcon (const QString &iconPath)
 Sets a default icon for path elements.
 
void setIconAt (int index, const QString &iconPath)
 Sets an icon for the path element at index.
 
QIcon iconAt (int index)
 Gets the icon for the path element at index.
 
bool isEditable () const
 
void setEditable (bool editable)
 
bool getPushPathOnLinkActivation () const
 Returns true if activating a link should automatically push a new path to the navigation stack.
 
void setPushPathOnLinkActivation (bool pushPath)
 Sets whether activating a link should automatically push a new path to the navigation stack.
 
QToolButton * createButton (NavigationButton type)
 
QWidget * createBackForwardToolBar ()
 
QWidget * createSeparator ()
 
QSize sizeHint () const override
 

Static Public Member Functions

static Config loadConfig (QSettings &settings)
 
static Config defaultConfig ()
 Gets the default Breadcrumbs style configuration.
 

Protected Member Functions

void resizeEvent (QResizeEvent *event) override
 
void changeEvent (QEvent *event) override
 
bool eventFilter (QObject *obj, QEvent *ev) override
 

Properties

bool editable
 

Friends

class Style
 

Detailed Description

Specialized widget to create html-style clickable links for each part of a path. Provides state management and signals for handling common path navigation functionality (back, forward and up). Can be styled by modifying BreadCrumbs.qss and BreadCrumbsConfig.ini. Note that Qt doesn't handle HTML embedded in QLabel widgets gracefully - stylesheets are not shared between those and Qt objects. As a result, the color of the HTML styled links in the BreadCrumbs is specified in BreadCrumbsConfig.ini.

Member Function Documentation

◆ backAvailabilityChanged

void AzQtComponents::BreadCrumbs::backAvailabilityChanged ( bool  enabled)
signal

Triggered after a change to the navigation stack, if back is available. Used to update back buttons.

Parameters
enabledThe new back availability state after the change.

◆ createBackForwardToolBar()

QWidget* AzQtComponents::BreadCrumbs::createBackForwardToolBar ( )

Creates a widget containing the back and forward buttons.

Returns
The pointer to the newly created QWidget. Note: the widget will need to be added to a layout manually.

◆ createButton()

QToolButton* AzQtComponents::BreadCrumbs::createButton ( NavigationButton  type)

Creates a button of the type specified.

Parameters
typeThe type of button to create.
Returns
The pointer to the newly created QToolButton. Note: the button will need to be added to a layout manually.

◆ createSeparator()

QWidget* AzQtComponents::BreadCrumbs::createSeparator ( )

Creates a separator styled to match the Breadcrumbs widget.

Returns
The pointer to the newly created separator. Note: the separator will need to be added to a layout manually.

◆ forwardAvailabilityChanged

void AzQtComponents::BreadCrumbs::forwardAvailabilityChanged ( bool  enabled)
signal

Triggered after a change to the navigation stack, if forward is available. Used to update forward buttons.

Parameters
enabledThe new forward availability state after the change.

◆ linkClicked

void AzQtComponents::BreadCrumbs::linkClicked ( const QString &  linkPath,
int  linkIndex 
)
signal

Triggered when a link is clicked.

Parameters
linkPathThe path of the clicked link.
linkIndexThe index of the link.

◆ loadConfig()

static Config AzQtComponents::BreadCrumbs::loadConfig ( QSettings &  settings)
static

Sets the Breadcrumbs style configuration.

Parameters
settingsThe settings object to load the configuration from.
Returns
The new configuration of the Breadcrumbs.

◆ pathChanged

void AzQtComponents::BreadCrumbs::pathChanged ( const QString &  fullPath)
signal

Triggered when the currently displayed path changes via any of the slots.

Returns
fullPath The new path after the change.

◆ pathEdited

void AzQtComponents::BreadCrumbs::pathEdited ( const QString &  requestedPath)
signal

Triggered after user changes the path in editable BreadCrumbs.

Warning
the actual path won't be pushed and the BreadCrumbs won't change. It's up to the user of this class to first check the validity of the path provided by the user and call e.g. pushPath() to actually change what is stored in the breadcrumbs

◆ pushFullPath

void AzQtComponents::BreadCrumbs::pushFullPath ( const QString &  newFullPath,
const QString &  newPath 
)
slot

Pushes a new full path to be displayed in the editable breadcrumbs, and a new path to be shown in the breadcrumbs navigation bar.

◆ sizeHint()

QSize AzQtComponents::BreadCrumbs::sizeHint ( ) const
override

Size hint reports the space that would be taken if the whole path would be shown.

◆ startEditing

void AzQtComponents::BreadCrumbs::startEditing ( )
slot

Initiate editing of the path in BreadCrumbs.

This could be called when e.g. user presses some combination like Ctrl+L in an appropriate context. It will work only for editable instances (

See also
isEditable()). Calling this on BreadCrumbs that are already edited is a no-op.

The documentation for this class was generated from the following file: