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

#include <CardHeader.h>

Inherits QFrame.

Public Types

enum  ContextMenuIcon { Standard , Plus }
 Enum used to determine which icon to use for the context menu button. More...
 

Signals

void contextMenuRequested (const QPoint &position)
 Triggered when the context menu button is clicked, or on a right click.
 
void expanderChanged (bool expanded)
 Triggered when the expander state is changed.
 
void warningChanged (bool warning)
 Triggered when the warning state is changed.
 
void readOnlyChanged (bool readOnly)
 Triggered when the read only state is changed.
 
void contentModifiedChanged (bool modified)
 Triggered when the content modified state is changed.
 
void iconLabelClicked (const QPoint &position)
 Triggered when the icon label is clicked.
 

Public Member Functions

 CardHeader (QWidget *parent=nullptr)
 
void setTitle (const QString &title)
 Sets the Card Header title. Passing an empty string will hide the Card Header.
 
void setTitleToolTip (const QString &toolTip)
 Sets the tool tip for the card header and card header title.
 
QString title () const
 Returns the current title.
 
AzQtComponents::ElidingLabeltitleLabel () const
 Returns a direct pointer to the title label.
 
void setFilter (const QString &filterString)
 
void setTitleProperty (const char *name, const QVariant &value)
 
void refreshTitle ()
 
void setIcon (const QIcon &icon)
 Sets the icon. Passing a null icon will hide the current icon.
 
void setIconOverlay (const QIcon &icon)
 Sets a secondary icon to be drawn on top of the main icon.
 
void setIconClickable (bool clickable)
 Set whether the icon can be clicked to trigger an event.
 
bool isIconClickable () const
 Returns true if the icon can be clicked to trigger an event, false otherwise.
 
void setExpandable (bool expandable)
 
bool isExpandable () const
 Returns true if the Card Header is showing and expander button, false otherwise.
 
void setExpanded (bool expanded)
 Sets the parent Card's expanded state.
 
bool isExpanded () const
 Returns the parent Card's expanded state.
 
void setWarning (bool warning)
 Sets the warning state on the Card Header.
 
bool isWarning () const
 Returns true if the Card Header's warning state is set, false otherwise.
 
void setWarningIcon (const QIcon &icon)
 Sets a new QIcon for the warning state.
 
void setReadOnly (bool readOnly)
 Sets the read only state on the Card Header.
 
bool isReadOnly () const
 Returns true if the Card Header's read only state is set, false otherwise.
 
void setContentModified (bool modified)
 Sets the modified state on the Card Header.
 
bool isContentModified () const
 Returns true if the Card Header's modified state is set, false otherwise.
 
void setHasContextMenu (bool showContextMenu)
 
void setHelpURL (const QString &url)
 
void clearHelpURL ()
 Resets the help url and hides the question mark button.
 
QString helpURL () const
 Returns the help url for this Card Header if set.
 
void configSettingsChanged ()
 Forces a refresh of the icon and warning icon on the Card Header.
 
void mockDisabledState (bool disabled)
 
void setContextMenuIcon (ContextMenuIcon iconType)
 Sets the icon to be displayed for the context menu.
 
void setUnderlineColor (const QColor &color)
 

Static Public Member Functions

static void applyContainerStyle (CardHeader *header)
 
static void applySectionStyle (CardHeader *header)
 
static void setIconSize (int iconSize)
 Sets the size of the Card header's icon.
 
static int defaultIconSize ()
 Returns the default size for the Card Header's icon.
 

Static Public Attributes

static int s_iconSize
 

Protected Member Functions

void mouseDoubleClickEvent (QMouseEvent *event) override
 
void contextMenuEvent (QContextMenuEvent *event) override
 
void triggerContextMenuUnderButton ()
 
void triggerHelpButton ()
 
void triggerIconLabelClicked (const QPoint &position)
 
void updateIconLabel ()
 Assign a pixmap for the icon label based on current properties.
 

Static Protected Member Functions

static bool isCardHeaderIcon (const QWidget *widget)
 
static bool isCardHeaderMenuButton (const QWidget *widget)
 

Protected Attributes

QVBoxLayout * m_mainLayout = nullptr
 
QHBoxLayout * m_backgroundLayout = nullptr
 
QFrame * m_backgroundFrame = nullptr
 
QCheckBox * m_expanderButton = nullptr
 
Internal::ClickableIconLabel * m_iconLabel = nullptr
 
AzQtComponents::ElidingLabelm_titleLabel = nullptr
 
QLabel * m_warningLabel = nullptr
 
QPushButton * m_contextMenuButton = nullptr
 
QPushButton * m_helpButton = nullptr
 
Internal::RectangleWidget * m_underlineWidget = nullptr
 
bool m_warning = false
 
bool m_readOnly = false
 
bool m_modified = false
 
QIcon m_warningIcon
 
QIcon m_icon
 
QIcon m_iconOverlay
 
QString m_helpUrl
 

Properties

bool warning
 Enable warning styling.
 
bool readOnly
 Enable read-only styling.
 
bool contentModified
 Enable content modified styling.
 

Friends

class Card
 

Detailed Description

Header bar for Card widgets. Provides a bar with an expander arrow, a text title and a button to trigger a context menu. Also has an optional icon and help button. Sub widgets are hidden by default and will show once they're configured via the appropriate setter. For example, setIcon will cause the icon widget to appear.

Member Enumeration Documentation

◆ ContextMenuIcon

Enum used to determine which icon to use for the context menu button.

Enumerator
Standard 

Hamburger menu button.

Plus 

Plus button, usually tied to add actions.

Member Function Documentation

◆ mockDisabledState()

void AzQtComponents::CardHeader::mockDisabledState ( bool  disabled)

Sets the mock disabled state. This will make the Card Header look disabled, but the buttons will still work.

◆ refreshTitle()

void AzQtComponents::CardHeader::refreshTitle ( )

Forces a repaint of the title. Can be used to refresh the widget after style or property changes are applied.

◆ setExpandable()

void AzQtComponents::CardHeader::setExpandable ( bool  expandable)

Set whether the header displays an expander button. Note that the header itself will not change size or hide, it simply causes the onExpanderChanged signal to fire.

◆ setFilter()

void AzQtComponents::CardHeader::setFilter ( const QString &  filterString)

Sets the filter string. If the title contains the filter string, it will be highlighted. Used to enhance searches.

◆ setHasContextMenu()

void AzQtComponents::CardHeader::setHasContextMenu ( bool  showContextMenu)

Sets whether the header has a context menu widget. This determines whether or not the contextMenuRequested signal fires on right-click, or when the context menu button is pressed.

◆ setHelpURL()

void AzQtComponents::CardHeader::setHelpURL ( const QString &  url)

Sets the help url on the Card Header. If a url is set, a question mark icon will be displayed on the right and it will open the default browser on the url provided on click.

◆ setTitleProperty()

void AzQtComponents::CardHeader::setTitleProperty ( const char *  name,
const QVariant &  value 
)

Sets a custom property to the title label. Can be used to

◆ setUnderlineColor()

void AzQtComponents::CardHeader::setUnderlineColor ( const QColor &  color)

Sets the small solid color underline under the header. If color is invalid or transparent, the underline will disappear completely.


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