VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes
makVrv::DtToolbarWidget Class Referenceabstract

A wrapper class for toolbar widgets.

A DtToolbarWidget is a widget that is a child to a QToolBar. A DtToolbarWidget is composed of a QHBoxLayout (myWidgetLayout).

The class is responsible for ensuring the toolbar widget appearance is consistent with the current tool button style of the parent toolbar. In order for this to work properly, inheriting tool button widget classes need to: 1) During setup of GUI, A) Use utility method configureToolButton(...) OR configure myToolButton directly. B) Use myWidgetLayout as the main layout, e.g. to add custom child widgets 2) Call setToolButtonChecked(bool checked) to update state when needed 3) Define abstract methods: on_toolButtonClicked 4) Define setWidgetsVisible to toggle the visibility of custom child widgets

Inheritance diagram for makVrv::DtToolbarWidget:
Inheritance graph
[legend]

Public Member Functions

 DtToolbarWidget (DtDe &de, QWidget *p=0, Qt::WindowFlags f=0)
 
virtual ~DtToolbarWidget ()
 
void setToolButtonChecked (bool checked)
 
bool isToolButtonChecked () const
 
void setToolButtonStyle (Qt::ToolButtonStyle style)
 
Qt::ToolButtonStyle toolButtonStyle () const
 

Protected Slots

virtual void on_toolButtonStyleChanged (Qt::ToolButtonStyle val)
 
virtual void on_toolButtonClicked (bool checked)=0
 
virtual void on_aboutToShow ()
 

Protected Member Functions

virtual void configureToolButton (const QString &text, const QString &tooltip, const QString &iconFilename, bool checkable=false, bool hasMenu=false, QToolButton::ToolButtonPopupMode menuMode=QToolButton::DelayedPopup, const QString &checkedIconFilePath=QString(""))
 
virtual void configureThemedToolButton (const QString &text, const QString &tooltip, const QString &iconFilename, bool checkable=false, bool hasMenu=false, QToolButton::ToolButtonPopupMode menuMode=QToolButton::DelayedPopup, const QString &checkedIconFileName=QString(""))
 
virtual void setWidgetsVisible (bool visible)
 

Protected Attributes

DtDemyDe
 
QToolButtonmyToolButton
 
QHBoxLayout * myWidgetLayout
 

Constructor & Destructor Documentation

makVrv::DtToolbarWidget::DtToolbarWidget ( DtDe de,
QWidget *  p = 0,
Qt::WindowFlags  f = 0 
)

CTOR The parent widget should be a QToolBar so that we can connect to its toolButtonStyleChanged(Qt::ToolButtonStyle) signal.

virtual makVrv::DtToolbarWidget::~DtToolbarWidget ( )
virtual

DTOR.

Member Function Documentation

void makVrv::DtToolbarWidget::setToolButtonChecked ( bool  checked)

Set/Get whether or not the tool button is checked.

bool makVrv::DtToolbarWidget::isToolButtonChecked ( ) const

Set/Get whether or not the tool button is checked.

void makVrv::DtToolbarWidget::setToolButtonStyle ( Qt::ToolButtonStyle  style)

Set/Get the current toolbutton style If myToolButton is uninitialized, the getter defaults to returning Qt::ToolButtonFollowStyle.

Qt::ToolButtonStyle makVrv::DtToolbarWidget::toolButtonStyle ( ) const

Set/Get the current toolbutton style If myToolButton is uninitialized, the getter defaults to returning Qt::ToolButtonFollowStyle.

virtual void makVrv::DtToolbarWidget::configureToolButton ( const QString &  text,
const QString &  tooltip,
const QString &  iconFilename,
bool  checkable = false,
bool  hasMenu = false,
QToolButton::ToolButtonPopupMode  menuMode = QToolButton::DelayedPopup,
const QString &  checkedIconFilePath = QString("") 
)
protectedvirtual

Configure the QToolButton for this toolbar widget.

Parameters
textThe text the QToolButton will display
tooltipThe tooltip of the QToolButton
iconFilenameThe absolute path to use for the icon for the tool button - if checkable, used when unchecked
checkableWhether or not the created QToolButton is checkable
hasMenuWhether or not the created QToolButton has a menu
menuModeThe mode that controls how the menu is shown (ignored if hasMenu is false)
checkedIconFilePathThe absolute path to use for the icon for the tool button when its checked - only used if checkable
virtual void makVrv::DtToolbarWidget::configureThemedToolButton ( const QString &  text,
const QString &  tooltip,
const QString &  iconFilename,
bool  checkable = false,
bool  hasMenu = false,
QToolButton::ToolButtonPopupMode  menuMode = QToolButton::DelayedPopup,
const QString &  checkedIconFileName = QString("") 
)
protectedvirtual

Configure the QToolButton for this toolbar widget.

Parameters
textThe text the QToolButton will display
tooltipThe tooltip of the QToolButton
iconFilenameThe filename of the icon to use for the tool button's QIcon - if checkable, used when unchecked
checkableWhether or not the created QToolButton is checkable
hasMenuWhether or not the created QToolButton has a menu
menuModeThe mode that controls how the menu is shown (ignored if hasMenu is false)
checkedIconFileNameThe filename of the icon to use when the tool button is checked - only used if checkable and non-empty This function differs from configureToolbutton in that it uses the DtWidgetIconStyleManager to ensure the icon gets updated whenever the light mode and dark mode application setting changes.
virtual void makVrv::DtToolbarWidget::setWidgetsVisible ( bool  visible)
protectedvirtual

Called whenever the ToolButtonStyle has changed.

Parameters
visibleWhether or not any custom widgets are visible This function should update the visibility of all widgets that are specific to the inheriting child class.

Reimplemented in makVrv::DtAudioVolumeWidget, makVrv::DtColorControlWidget, makVrv::DtModelScaleWidget, makVrv::DtGhostedToolbarWidget, and makVrv::DtEntityLabelsWidget.

virtual void makVrv::DtToolbarWidget::on_toolButtonStyleChanged ( Qt::ToolButtonStyle  val)
protectedvirtualslot

Updates widget to match the new ToolButtonStyle.

Parameters
valThe current ToolButtonStyle of the parent QToolBar This function calls setWidgetsVisible(val != Qt::ToolButtonTextOnly) and does nothing when val is Qt::ToolButtonFollowStyle.
virtual void makVrv::DtToolbarWidget::on_toolButtonClicked ( bool  checked)
protectedpure virtualslot

Slot when this widget's toolbutton has been clicked.

Parameters
checkedWhether or not the QToolButton is checked or not

Implemented in makVrv::DtGhostedToolbarWidget.

virtual void makVrv::DtToolbarWidget::on_aboutToShow ( )
protectedvirtualslot

Slot for when the menu for this widget is about to be shown The slot is only used if this toolbar widget is configured to have a menu. If so, the child class should override this definition to populate myToolButton->menu().

Member Data Documentation

DtDe& makVrv::DtToolbarWidget::myDe
protected
QToolButton* makVrv::DtToolbarWidget::myToolButton
protected
QHBoxLayout* makVrv::DtToolbarWidget::myWidgetLayout
protected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)