OpenWalnut  1.5.0dev
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
WQtDockTitleWidget Class Reference

Class for managing dock widget title bars. More...

#include <WQtDockTitleWidget.h>

+ Inheritance diagram for WQtDockTitleWidget:
+ Collaboration diagram for WQtDockTitleWidget:

Public Member Functions

 WQtDockTitleWidget (WQtDockWidget *parent)
 Constructor. More...
 
virtual void addTitleAction (QAction *action, bool instantPopup=false)
 Add the given action to the titlebar. More...
 
virtual void addTitleButton (QToolButton *button)
 Add the given tool button to the titlebar. More...
 
virtual void removeTitleAction (QAction *action)
 Remove the given action from the list. More...
 
virtual void addTitleSeperator ()
 Add a separator. More...
 
virtual void addTitleWidget (QWidget *widget)
 Add an arbitrary widget. More...
 
virtual void removeTitleWidget (QWidget *widget)
 Remove the specified widget from the title bar. More...
 
virtual void updateHelp ()
 Update help button. More...
 
void disableCloseButton (bool disable=true)
 Disable close button? Might come in handy when embedding these widgets into others. More...
 

Protected Member Functions

virtual void resizeEvent (QResizeEvent *event)
 Called upon resize. More...
 
virtual void setupButton (QToolButton *btn)
 Apply default settings for dock widget title buttons. More...
 
virtual void setupSizeConstraints (QWidget *widget)
 Apply size setup to a given widget. More...
 

Private Member Functions

void construct ()
 Construct the title and configure the widget. More...
 
void updateLayouts (int width)
 Updates the layouts according to the new width. More...
 

Private Attributes

QWidget * m_tools
 The tools buttons. More...
 
QWidget * m_toolsMenu
 The tool inside the menu. More...
 
QHBoxLayout * m_toolsLayout
 Layout containing the tools. More...
 
QToolButton * m_moreBtn
 The tool button used when shrinking the title bar too much. More...
 
QHBoxLayout * m_toolsMenuLayout
 LAyout of the items in the moreBtn menu. More...
 
WScaleLabelm_title
 Title label. More...
 
QToolButton * m_closeBtn
 Close button. More...
 
QToolButton * m_helpBtn
 Help button. More...
 
WQtDockWidgetm_dockParent
 The parent as dock pointer. More...
 
QList< QWidget * > m_titleActionWidgets
 We keep track of the widgets that we add. More...
 

Detailed Description

Class for managing dock widget title bars.

Definition at line 46 of file WQtDockTitleWidget.h.

Constructor & Destructor Documentation

◆ WQtDockTitleWidget()

WQtDockTitleWidget::WQtDockTitleWidget ( WQtDockWidget parent)
explicit

Constructor.

Parameters
parentthe parent

Definition at line 35 of file WQtDockTitleWidget.cpp.

References construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ addTitleAction()

void WQtDockTitleWidget::addTitleAction ( QAction action,
bool  instantPopup = false 
)
virtual

Add the given action to the titlebar.

It gets added after the previously added ones.

Parameters
actionthe action to add.
instantPopupif true, the button does not trigger an action. Instead, it directly opens the menu.

Definition at line 135 of file WQtDockTitleWidget.cpp.

References m_titleActionWidgets, setupButton(), setupSizeConstraints(), and updateLayouts().

Referenced by WQtDockWidget::addTitleAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTitleButton()

void WQtDockTitleWidget::addTitleButton ( QToolButton *  button)
virtual

Add the given tool button to the titlebar.

It gets added after the previously added ones.

Parameters
buttonthe action to add.

Definition at line 154 of file WQtDockTitleWidget.cpp.

References addTitleWidget(), setupButton(), and setupSizeConstraints().

Referenced by WQtDockWidget::addTitleButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTitleSeperator()

void WQtDockTitleWidget::addTitleSeperator ( )
virtual

Add a separator.

Definition at line 201 of file WQtDockTitleWidget.cpp.

References m_titleActionWidgets, and updateLayouts().

Referenced by WQtDockWidget::addTitleSeperator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTitleWidget()

void WQtDockTitleWidget::addTitleWidget ( QWidget *  widget)
virtual

Add an arbitrary widget.

Please take care of its size! This method sets a size policy and a fixed height.

Parameters
widgetthe widget to add

Definition at line 162 of file WQtDockTitleWidget.cpp.

References m_titleActionWidgets, setupSizeConstraints(), and updateLayouts().

Referenced by addTitleButton(), and WQtDockWidget::addTitleWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ construct()

void WQtDockTitleWidget::construct ( )
private

Construct the title and configure the widget.

Definition at line 56 of file WQtDockTitleWidget.cpp.

References WQtGui::getMainWindow(), m_closeBtn, m_dockParent, m_helpBtn, m_moreBtn, m_title, m_tools, m_toolsLayout, m_toolsMenu, m_toolsMenuLayout, setupButton(), and setupSizeConstraints().

Referenced by WQtDockTitleWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disableCloseButton()

void WQtDockTitleWidget::disableCloseButton ( bool  disable = true)

Disable close button? Might come in handy when embedding these widgets into others.

Parameters
disabletrue to disable

Definition at line 270 of file WQtDockTitleWidget.cpp.

References m_closeBtn.

Referenced by WQtDockWidget::disableCloseButton().

+ Here is the caller graph for this function:

◆ removeTitleAction()

void WQtDockTitleWidget::removeTitleAction ( QAction action)
virtual

Remove the given action from the list.

Parameters
actionthe action to add

Definition at line 185 of file WQtDockTitleWidget.cpp.

References m_titleActionWidgets, and removeTitleWidget().

Referenced by WQtDockWidget::removeTitleAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTitleWidget()

void WQtDockTitleWidget::removeTitleWidget ( QWidget *  widget)
virtual

Remove the specified widget from the title bar.

Parameters
widgetthe widget to remove

Definition at line 173 of file WQtDockTitleWidget.cpp.

References m_titleActionWidgets, m_toolsLayout, m_toolsMenuLayout, and updateLayouts().

Referenced by removeTitleAction(), and WQtDockWidget::removeTitleWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resizeEvent()

void WQtDockTitleWidget::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Called upon resize.

Used to switch between the more menu and the tools widget

Parameters
eventthe event

Definition at line 129 of file WQtDockTitleWidget.cpp.

References updateLayouts().

+ Here is the call graph for this function:

◆ setupButton()

void WQtDockTitleWidget::setupButton ( QToolButton *  btn)
protectedvirtual

Apply default settings for dock widget title buttons.

Parameters
btnthe button to setup

Definition at line 42 of file WQtDockTitleWidget.cpp.

Referenced by addTitleAction(), addTitleButton(), and construct().

+ Here is the caller graph for this function:

◆ setupSizeConstraints()

void WQtDockTitleWidget::setupSizeConstraints ( QWidget *  widget)
protectedvirtual

Apply size setup to a given widget.

Parameters
widgetthe widget to setup

Definition at line 48 of file WQtDockTitleWidget.cpp.

Referenced by addTitleAction(), addTitleButton(), addTitleWidget(), and construct().

+ Here is the caller graph for this function:

◆ updateHelp()

void WQtDockTitleWidget::updateHelp ( )
virtual

Update help button.

Definition at line 259 of file WQtDockTitleWidget.cpp.

References WQtDockWidget::getHelpContext(), m_dockParent, and m_helpBtn.

Referenced by WQtDockWidget::setHelpContext(), and WQtDockWidget::WQtDockWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLayouts()

void WQtDockTitleWidget::updateLayouts ( int  width)
private

Updates the layouts according to the new width.

Parameters
widththe new width.

Definition at line 215 of file WQtDockTitleWidget.cpp.

References WScaleLabel::calculateSize(), m_closeBtn, m_helpBtn, m_moreBtn, m_title, m_titleActionWidgets, m_toolsLayout, and m_toolsMenuLayout.

Referenced by addTitleAction(), addTitleSeperator(), addTitleWidget(), removeTitleWidget(), and resizeEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_closeBtn

QToolButton* WQtDockTitleWidget::m_closeBtn
private

Close button.

Definition at line 176 of file WQtDockTitleWidget.h.

Referenced by construct(), disableCloseButton(), and updateLayouts().

◆ m_dockParent

WQtDockWidget* WQtDockTitleWidget::m_dockParent
private

The parent as dock pointer.

Definition at line 186 of file WQtDockTitleWidget.h.

Referenced by construct(), and updateHelp().

◆ m_helpBtn

QToolButton* WQtDockTitleWidget::m_helpBtn
private

Help button.

Definition at line 181 of file WQtDockTitleWidget.h.

Referenced by construct(), updateHelp(), and updateLayouts().

◆ m_moreBtn

QToolButton* WQtDockTitleWidget::m_moreBtn
private

The tool button used when shrinking the title bar too much.

Definition at line 161 of file WQtDockTitleWidget.h.

Referenced by construct(), and updateLayouts().

◆ m_title

WScaleLabel* WQtDockTitleWidget::m_title
private

Title label.

Definition at line 171 of file WQtDockTitleWidget.h.

Referenced by construct(), and updateLayouts().

◆ m_titleActionWidgets

QList< QWidget* > WQtDockTitleWidget::m_titleActionWidgets
private

We keep track of the widgets that we add.

Definition at line 191 of file WQtDockTitleWidget.h.

Referenced by addTitleAction(), addTitleSeperator(), addTitleWidget(), removeTitleAction(), removeTitleWidget(), and updateLayouts().

◆ m_tools

QWidget* WQtDockTitleWidget::m_tools
private

The tools buttons.

Definition at line 146 of file WQtDockTitleWidget.h.

Referenced by construct().

◆ m_toolsLayout

QHBoxLayout* WQtDockTitleWidget::m_toolsLayout
private

Layout containing the tools.

Definition at line 156 of file WQtDockTitleWidget.h.

Referenced by construct(), removeTitleWidget(), and updateLayouts().

◆ m_toolsMenu

QWidget* WQtDockTitleWidget::m_toolsMenu
private

The tool inside the menu.

Definition at line 151 of file WQtDockTitleWidget.h.

Referenced by construct().

◆ m_toolsMenuLayout

QHBoxLayout* WQtDockTitleWidget::m_toolsMenuLayout
private

LAyout of the items in the moreBtn menu.

Definition at line 166 of file WQtDockTitleWidget.h.

Referenced by construct(), removeTitleWidget(), and updateLayouts().


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