OpenWalnut
1.5.0dev
|
Class for managing dock widget title bars. More...
#include <WQtDockTitleWidget.h>
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... | |
WScaleLabel * | m_title |
Title label. More... | |
QToolButton * | m_closeBtn |
Close button. More... | |
QToolButton * | m_helpBtn |
Help button. More... | |
WQtDockWidget * | m_dockParent |
The parent as dock pointer. More... | |
QList< QWidget * > | m_titleActionWidgets |
We keep track of the widgets that we add. More... | |
Class for managing dock widget title bars.
Definition at line 46 of file WQtDockTitleWidget.h.
|
explicit |
Constructor.
parent | the parent |
Definition at line 35 of file WQtDockTitleWidget.cpp.
References construct().
|
virtual |
Add the given action to the titlebar.
It gets added after the previously added ones.
action | the action to add. |
instantPopup | if 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().
|
virtual |
Add the given tool button to the titlebar.
It gets added after the previously added ones.
button | the action to add. |
Definition at line 154 of file WQtDockTitleWidget.cpp.
References addTitleWidget(), setupButton(), and setupSizeConstraints().
Referenced by WQtDockWidget::addTitleButton().
|
virtual |
Add a separator.
Definition at line 201 of file WQtDockTitleWidget.cpp.
References m_titleActionWidgets, and updateLayouts().
Referenced by WQtDockWidget::addTitleSeperator().
|
virtual |
Add an arbitrary widget.
Please take care of its size! This method sets a size policy and a fixed height.
widget | the widget to add |
Definition at line 162 of file WQtDockTitleWidget.cpp.
References m_titleActionWidgets, setupSizeConstraints(), and updateLayouts().
Referenced by addTitleButton(), and WQtDockWidget::addTitleWidget().
|
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().
void WQtDockTitleWidget::disableCloseButton | ( | bool | disable = true | ) |
Disable close button? Might come in handy when embedding these widgets into others.
disable | true to disable |
Definition at line 270 of file WQtDockTitleWidget.cpp.
References m_closeBtn.
Referenced by WQtDockWidget::disableCloseButton().
|
virtual |
Remove the given action from the list.
action | the action to add |
Definition at line 185 of file WQtDockTitleWidget.cpp.
References m_titleActionWidgets, and removeTitleWidget().
Referenced by WQtDockWidget::removeTitleAction().
|
virtual |
Remove the specified widget from the title bar.
widget | the 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().
|
protectedvirtual |
Called upon resize.
Used to switch between the more menu and the tools widget
event | the event |
Definition at line 129 of file WQtDockTitleWidget.cpp.
References updateLayouts().
|
protectedvirtual |
Apply default settings for dock widget title buttons.
btn | the button to setup |
Definition at line 42 of file WQtDockTitleWidget.cpp.
Referenced by addTitleAction(), addTitleButton(), and construct().
|
protectedvirtual |
Apply size setup to a given widget.
widget | the widget to setup |
Definition at line 48 of file WQtDockTitleWidget.cpp.
Referenced by addTitleAction(), addTitleButton(), addTitleWidget(), and construct().
|
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().
|
private |
Updates the layouts according to the new width.
width | the 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().
|
private |
Close button.
Definition at line 176 of file WQtDockTitleWidget.h.
Referenced by construct(), disableCloseButton(), and updateLayouts().
|
private |
The parent as dock pointer.
Definition at line 186 of file WQtDockTitleWidget.h.
Referenced by construct(), and updateHelp().
|
private |
Help button.
Definition at line 181 of file WQtDockTitleWidget.h.
Referenced by construct(), updateHelp(), and updateLayouts().
|
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().
|
private |
Title label.
Definition at line 171 of file WQtDockTitleWidget.h.
Referenced by construct(), and updateLayouts().
|
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().
|
private |
|
private |
Layout containing the tools.
Definition at line 156 of file WQtDockTitleWidget.h.
Referenced by construct(), removeTitleWidget(), and updateLayouts().
|
private |
The tool inside the menu.
Definition at line 151 of file WQtDockTitleWidget.h.
Referenced by construct().
|
private |
LAyout of the items in the moreBtn menu.
Definition at line 166 of file WQtDockTitleWidget.h.
Referenced by construct(), removeTitleWidget(), and updateLayouts().