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::SegmentControl Class Reference

A container that uses a SegmentBar to switch between different sections of associated information. More...

#include <SegmentControl.h>

Inherits QFrame.

Public Types

enum  TabPosition { North , South , West , East }
 Enum listing the tab position relative to the segment bar.
 

Public Slots

void setCurrentIndex (int index)
 
void setCurrentWidget (QWidget *widget)
 

Signals

void currentChanged (int index)
 Triggered when the current tab is changed.
 
void tabBarClicked (int index)
 Triggered when a tab is clicked by the user.
 

Public Member Functions

 SegmentControl (QWidget *parent=nullptr)
 
 SegmentControl (SegmentControl::TabPosition position, QWidget *parent=nullptr)
 
 SegmentControl (SegmentBar *bar, SegmentControl::TabPosition position, QWidget *parent=nullptr)
 
int addTab (QWidget *widget, const QString &text)
 Appends a content widget as a new tab.
 
int addTab (QWidget *widget, const QIcon &icon, const QString &text)
 Appends a content widget as a new tab with an icon.
 
int insertTab (int index, QWidget *widget, const QString &text)
 Inserts a content widget as a new tab at the given index.
 
int insertTab (int index, QWidget *widget, const QIcon &icon, const QString &text)
 Inserts a content widget as a new tab with an icon at the given index.
 
void removeTab (int index)
 Removes the tab at the given index.
 
void moveTab (int from, int to)
 
void setTabEnabled (int index, bool enabled)
 Sets enabled state for the tab at the given index.
 
bool isTabEnabled (int index) const
 Returns the enabled state for the tab at the given index.
 
void setTabText (int index, const QString &text)
 Sets the text to the tab at the given index.
 
QString tabText (int index) const
 Returns the text of the tab at the given index.
 
void setTabIcon (int index, const QIcon &icon)
 Sets the icon to the tab at the given index.
 
QIcon tabIcon (int index) const
 Returns the icon of the tab at the given index.
 
void setTabToolTip (int index, const QString &tip)
 Sets the tooltip text for the tab at the given index.
 
QString tabToolTip (int index) const
 Returns the tooltip text of the tab at the given index.
 
void setTabWhatsThis (int index, const QString &text)
 Sets the "What's this?" text to the tab at the given index.
 
QString tabWhatsThis (int index) const
 Returns the "What's this?" text of the tab at the given index.
 
void setTabOrientation (Qt::Orientation orientation)
 Sets the segment bar orientation.
 
Qt::Orientation tabOrientation () const
 Returns the segment bar orientation.
 
void setTabPosition (SegmentControl::TabPosition position)
 Sets the position of the content tabs relative to the segment bar.
 
SegmentControl::TabPosition tabPosition () const
 Returns the position of the content tabs relative to the segment bar.
 
int currentIndex () const
 Returns the index of the currently selected tab.
 
QWidget * currentWidget () const
 Returns a pointer to the widget tied to the currently selected tab.
 
QWidget * widget (int index) const
 Returns a pointer to the widget at the index provided.
 
int indexOf (QWidget *widget) const
 
int count () const
 Returns the number of tabs.
 
void setIconSize (const QSize &size)
 
QSize iconSize () const
 Returns the icon size.
 
void clear ()
 Removes all tabs from the container.
 
SegmentBartabBar () const
 Returns a pointer to the underlying segment bar.
 

Properties

Qt::Orientation tabOrientation
 Orientation of the segment bar. Horizontal bars are ordered left to right, vertical ones go top to bottom.
 
SegmentControl::TabPosition tabPosition
 Position of the content related to the segment bar.
 
int currentIndex
 Index of the currently selected segment.
 
int count
 The number of tabs in the SegmentControl.
 
QSize iconSize
 Size of the icons in the SegmentControl.
 

Detailed Description

A container that uses a SegmentBar to switch between different sections of associated information.

Member Function Documentation

◆ indexOf()

int AzQtComponents::SegmentControl::indexOf ( QWidget *  widget) const

Returns the tab index of the widget provided, if found in this container.

Returns
The index of the tab containing the widget, or -1 if not found.

◆ moveTab()

void AzQtComponents::SegmentControl::moveTab ( int  from,
int  to 
)

Moves the tab from a position to another. The tabs between 'to' and 'from' will have their indices shifted to fill the void.

◆ setIconSize()

void AzQtComponents::SegmentControl::setIconSize ( const QSize &  size)

Sets the maximum icon size. Smaller icons will not be scaled up, but bigger icons will be shrunk. The icon will be stretched to fit.


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