DockBarManager Class

Class DockBarManager is used to add Microsoft-like dock bars to the certain QWidget. More...

Header: #include <DockBarManager>
Inherits: QObject

Public Functions

DockBarManager(QWidget *widget)
DockToolBar *addToolBar(const QString &name, Qtitan::DockBarArea dockBarArea)
QWidget *centralWidget() const
void clearDockBars()
DockBarBase *dockBarAt(int index) const
int dockBarCount() const
const QList<DockBarBase *> &dockBars() const
void insertDockBar(DockToolBar *before, DockToolBar *toolBar)
bool insertDockBar(DockToolBar *toolBar, Qtitan::DockBarArea dockBarArea)
bool loadStateFromFile(const QString &fileName)
QWidget *managedWidget() const
void moveDockBar(DockToolBar *before, DockToolBar *toolBar)
void removeDockBar(DockToolBar *toolBar)
bool saveStateToDevice(QIODevice *device, bool autoFormatting = true)
bool saveStateToFile(const QString &fileName, bool autoFormatting = true)
void setCentralWidget(QWidget *widget)
QList<DockToolBar *> toolBars() const

Detailed Description

The example below demonstrates the simplest use of the manager.

QWidget* widget = new QWidget;
DockBarManager* manager = new DockBarManager(widget);
DockToolBar* tooBar = manager->addToolBar("My Toolbar", Qtitan::ToolBarTop);
tooBar->addAction("Button");
widget->show();

DockBarManager can be used with DockPanelManager on the same QWidget together. Normally, you do not need to create it manually. Use DockMainWindow to get the main window, which contains the DockBarManager and a set of functions for bars creation.

See also DockPanelManager.

Member Function Documentation

DockBarManager::DockBarManager(QWidget *widget)

Constructs the class with the given widget on which the docking mechanism will be deployed.

DockToolBar *DockBarManager::addToolBar(const QString &name, Qtitan::DockBarArea dockBarArea)

Creates and returns dock tool bar with the given name and dockBarArea.

QWidget *DockBarManager::centralWidget() const

Returns the central widget for the dock layout.

See also setCentralWidget().

void DockBarManager::clearDockBars()

Removes all dock bars from the dock bar manager and destroy its instanceses. Note: All bar's references become invalid after this call.

DockBarBase *DockBarManager::dockBarAt(int index) const

Returns dock bar by the index.

See also dockBars().

int DockBarManager::dockBarCount() const

Returns count of dock bars.

See also dockBars().

const QList<DockBarBase *> &DockBarManager::dockBars() const

Returns QList of all dock bar that manager owns.

void DockBarManager::insertDockBar(DockToolBar *before, DockToolBar *toolBar)

Inserts toolBar before bar before. It appends the toolBar if before is 0 or before is not found in the bar's list.

bool DockBarManager::insertDockBar(DockToolBar *toolBar, Qtitan::DockBarArea dockBarArea)

Inserts toolBar at the dockBarArea. Retruns true if success, otherwise return false.

bool DockBarManager::loadStateFromFile(const QString &fileName)

Load from XML/FastInfoset of the internals dock bars from the given fileName.

See also loadStateFromDevice().

QWidget *DockBarManager::managedWidget() const

Returns the managed widget.

void DockBarManager::moveDockBar(DockToolBar *before, DockToolBar *toolBar)

Moves toolBar before the dock bar before. If toolBar has not been added to the manager yet then use insertDockBar(DockToolBar* before, DockToolBar* toolBar) instead to add it.

void DockBarManager::removeDockBar(DockToolBar *toolBar)

Removes toolBar from the dock bar manager and clear all internal structures regarding this bar. Note that the function does not destroy the instance of toolBar. After calling this function, you must delete the toolBar manually using the operator 'delete'.

bool DockBarManager::saveStateToDevice(QIODevice *device, bool autoFormatting = true)

Save to XML/FastInfoset of the dock bars internals to the device with given autoFormatting.

See also saveStateToFile().

bool DockBarManager::saveStateToFile(const QString &fileName, bool autoFormatting = true)

Save to XML/FastInfoset of the dock bars internals to the file given by fileName with given autoFormatting.

See also saveStateToDevice().

void DockBarManager::setCentralWidget(QWidget *widget)

Sets the central widget for the dock layout. Actualy it is query the layout from the managedWidget() and sets the central widget to it. If you have DockPanelManager and DockBarManager on the same QWidget then DockPanelManager::setCentralWidget() and DockBarManager::setCentralWidget() do the identical thing.

See also centralWidget().

QList<DockToolBar *> DockBarManager::toolBars() const

Creates QList of all dock bar that implements DockToolBar.

See also dockBars().