DockPanelManager Class

Class DockPanelManager is used to add Microsoft-like dockable panels to the QWidget. More...

Header: #include <DockPanelManager>
Inherits: QObject

Public Functions

DockPanelManager(QWidget *widget)
DockPanelManager(QMainWindow *mainWindow)
DockWidgetPanel *activeDockPanel() const
DockWidgetPanel *addDockPanel(const QString &title, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)
DockWidgetPanel *addDockPanel(const QString &title, const QSize &sizeHint, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)
DockWindow *addDockWindow(DockPanelBase *panelBase, const QRect &rect)
DockDocumentPanel *addDocumentPanel(const QString &title)
void beginUpdate()
void bestFit()
QWidget *centralWidget() const
void clearDockPanels()
DockLayoutPanel *createDocumentLayout() const
const QString &dockWindowTitle() const
QList<DockDocumentPanel *> documentPanelList() const
void endUpdate()
void forgetDockPanel(const QString &id)
void insertDockPanel(DockWidgetPanel *panel, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)
void insertDockPanel(DockWidgetPanel *panel, const QSize &sizeHint, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)
void insertDocumentPanel(DockDocumentPanel *documentPanel)
DockLayoutPanel *layoutPanel() const
bool loadStateFromDevice(QIODevice *device)
bool loadStateFromFile(const QString &fileName)
bool loadStateFromXML(IXmlStreamReader *xmlreader)
QWidget *managedWidget() const
DockPanelOptions &options() const
void removeDockPanel(DockWidgetPanel *panel)
bool restoreDockPanel(DockWidgetPanel *panel)
bool saveStateToDevice(QIODevice *device, bool autoFormatting = true)
bool saveStateToFile(const QString &fileName, bool autoFormatting = true)
bool saveStateToXML(IXmlStreamWriter *xmlwriter)
void setArrowMarkersShown(bool show)
void setCentralWidget(QWidget *widget)
void setDefaultPaneFeatures(DockWidgetPanel::DockPanelFeatures features)
void setDockPanelFullContentsWhileDraggingShown(bool show)
void setDockPanelTransparentWhileDragging(bool transparent)
void setDockWindowTitle(const QString &title)
void showDockPanel(DockWidgetPanel *widgetPanel, bool setFocus = true)
QList<DockWidgetPanel *> widgetPanelList() const

Signals

void aboutToAutoHide(DockPanelBase *panel, bool &handled)
void aboutToClose(DockPanelBase *panel, bool &handled)
void aboutToFloat(DockPanelBase *panel, bool &handled)
void aboutToShow(DockPanelBase *panel, bool &handled)
void dockPanelActivated(DockWidgetPanel *panel)
void dockPanelDeactivated(DockWidgetPanel *panel)
void panelRequested(DockPanelRequestedArgs *args)

Static Public Members

bool loadTranslation(const QString &country = QString())

Detailed Description

The example below demonstrates the simplest use of the manager with QMainWindow and regular QWidget.

QMainWindow window;
window.setCentralWidget(new QTextEdit());
DockPanelManager* dockPanelManager = new DockPanelManager(&window);
dockPanelManager->options().setDockPanelTransparentWhileDragging(true);
dockPanelManager->options().setArrowMarkersShown(true);
dockPanelManager->options().setDockPanelFullContentsWhileDraggingShown(true);
DockWidgetPanel* panel1 = dockPanelManager->addDockPanel("Simple panel 1", Qtitan::LeftDockPanelArea);
DockWidgetPanel* panel2 = dockPanelManager->addDockPanel("Simple panel 2", Qtitan::BottomDockPanelArea);
window.show();
QWidget* widget = new QWidget;
DockPanelManager* manager = new DockPanelManager(widget);
DockWidgetPanel* dockPanel = manager->addDockPanel("My Panel", Qt::LeftDockWidgetArea);
widget->show();

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

See also DockBarManager.

Member Function Documentation

[explicit] DockPanelManager::DockPanelManager(QWidget *widget)

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

[explicit] DockPanelManager::DockPanelManager(QMainWindow *mainWindow)

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

[signal] void DockPanelManager::aboutToAutoHide(DockPanelBase *panel, bool &handled)

Triggered before the panel goes into the auto-hide mode. To prevent the panel from auto-hiding, set the handled to "false".

[signal] void DockPanelManager::aboutToClose(DockPanelBase *panel, bool &handled)

Triggered before the panel becomes closed. To prevent the panel from hiding, set the handled to "false".

[signal] void DockPanelManager::aboutToFloat(DockPanelBase *panel, bool &handled)

Triggered before the panel goes into the float mode. To prevent the panel from floating, set the handled to "false".

[signal] void DockPanelManager::aboutToShow(DockPanelBase *panel, bool &handled)

Triggered before the panel becomes visible. To prevent the panel from showing, set the handled to "false".

DockWidgetPanel *DockPanelManager::activeDockPanel() const

Returns the current active dock panel.

DockWidgetPanel *DockPanelManager::addDockPanel(const QString &title, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)

Creates and returns the dock panel with the given title in the given area. Parameter before used to specify after which panel you want to add the current panel. If the parameter is 0, then the panel is added to the end.

DockWidgetPanel* panel_1 = dockPanelManager()->addDockPanel("Panel 1", Qtitan::LeftDockPanelArea);
DockWidgetPanel* panel_2 = dockPanelManager()->addDockPanel("Panel 2", Qtitan::LeftDockPanelArea);

DockWidgetPanel* panel_1 = dockPanelManager()->addDockPanel("Panel 1", Qtitan::LeftDockPanelArea);
DockWidgetPanel* panel_2 = dockPanelManager()->addDockPanel("Panel 2", Qtitan::BottomDockPanelArea, m_panel_1);

DockWidgetPanel* panel_1 = dockPanelManager()->addDockPanel("Panel 1", Qtitan::LeftDockPanelArea);
DockWidgetPanel* panel_2 = dockPanelManager()->addDockPanel("Panel 2", Qtitan::InsideDockPanelArea, m_panel_1);

DockWidgetPanel *DockPanelManager::addDockPanel(const QString &title, const QSize &sizeHint, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)

Creates and returns the dock panel with the given title in the given area. Parameter before used to specify after which panel you want to add the current panel. If the parameter is 0, then the panel is added to the end. Parameter sizeHint is used to specify the size of the new panel.

DockWindow *DockPanelManager::addDockWindow(DockPanelBase *panelBase, const QRect &rect)

Creates floating window (DockWindow) and adds panel to it with the given rect.

DockDocumentPanel *DockPanelManager::addDocumentPanel(const QString &title)

Creates and returns pointer to new DockDocumentPanel. Parameter title is a document name that will be displayed in tab.

void DockPanelManager::beginUpdate()

Starts update the layout.

void DockPanelManager::bestFit()

Fits the size of the dock panels to provide the user with a comfortable view.

QWidget *DockPanelManager::centralWidget() const

Returns the central widget for the dock layout.

See also setCentralWidget().

void DockPanelManager::clearDockPanels()

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

DockLayoutPanel *DockPanelManager::createDocumentLayout() const

Creates and returns DockDocumentLayoutPanel that can holds DockDocumentPanel.

[signal] void DockPanelManager::dockPanelActivated(DockWidgetPanel *panel)

Triggered if the panel becomes active.

[signal] void DockPanelManager::dockPanelDeactivated(DockWidgetPanel *panel)

Triggered if the panel becomes unactive.

const QString &DockPanelManager::dockWindowTitle() const

Returns a default title for the dock window.

See also setDockWindowTitle().

QList<DockDocumentPanel *> DockPanelManager::documentPanelList() const

Returns the list of all document panels that were added earlier.

void DockPanelManager::endUpdate()

Ends update the layout.

void DockPanelManager::forgetDockPanel(const QString &id)

Removes any information regarding history, location, restoring for the panel by its id.

void DockPanelManager::insertDockPanel(DockWidgetPanel *panel, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)

Inserts an existing dock panel to the dock layout to the given area. Parameter before used to specify after which panel you want to add the current panel. If the parameter is 0, then the panel is added to the end.

void DockPanelManager::insertDockPanel(DockWidgetPanel *panel, const QSize &sizeHint, Qtitan::DockPanelArea area, DockPanelBase *targetPanel = Q_NULL)

Inserts an existing dock panel to the dock layout to the given area. Parameter before used to specify after which panel you want to add the current panel. If the parameter is 0, then the panel is added to the end. Parameter sizeHint is used to specify the size of the panel.

void DockPanelManager::insertDocumentPanel(DockDocumentPanel *documentPanel)

Inserts existing documentPanel to DockDocumentLayoutPanel. Parameter documentPanel is a pointer to DockDocumentPanel.

DockLayoutPanel *DockPanelManager::layoutPanel() const

Returns the root layout panel for the managed widget.

bool DockPanelManager::loadStateFromDevice(QIODevice *device)

Restores the dock panels state from the device.

See also loadStateFromFile() and loadStateFromXML().

bool DockPanelManager::loadStateFromFile(const QString &fileName)

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

See also loadStateFromDevice() and loadStateFromXML().

bool DockPanelManager::loadStateFromXML(IXmlStreamReader *xmlreader)

Restores the dock panels state from the XML stream - xmlreader.

See also loadStateFromFile() and loadStateFromDevice().

[static] bool DockPanelManager::loadTranslation(const QString &country = QString())

Installs translator to QApplication based on country variable. Format variable is de_de, ru_ru, fr_fr. If country is empty then loaded QTranslator based on current locale setting.

QWidget *DockPanelManager::managedWidget() const

Returns the managed widget.

DockPanelOptions &DockPanelManager::options() const

Returns the options for dock manager.

[signal] void DockPanelManager::panelRequested(DockPanelRequestedArgs *args)

Triggered at the time of loading the layout from the XML if the panel has not yet been created in the manager. The args contains the "id" and other attributes of the requested panel. You can create a panel with a given args->id() or ignore the signal and create a panel after. To restore its position after, use the restoreDockPanel().

void DockPanelManager::removeDockPanel(DockWidgetPanel *panel)

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

bool DockPanelManager::restoreDockPanel(DockWidgetPanel *panel)

Restores the state and position of panel if it is created after calling loadStateFromFile(), loadStateFromDevice() or loadStateFromXML(). Returns true if the state was restored, otherwise returns false.

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

Saves the dock panels state to the device with given autoFormatting.

See also saveStateToFile() and saveStateToXML().

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

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

See also saveStateToDevice() and saveStateToXML().

bool DockPanelManager::saveStateToXML(IXmlStreamWriter *xmlwriter)

Saves the dock panels state to the XML stream - xmlwriter.

See also saveStateToFile() and saveStateToDevice().

void DockPanelManager::setArrowMarkersShown(bool show)

Deprecated. Use DockPanelOptions::setArrowMarkersShown() instead.

void DockPanelManager::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().

void DockPanelManager::setDefaultPaneFeatures(DockWidgetPanel::DockPanelFeatures features)

Deprecated. Use DockPanelOptions::setFeatures() instead.

void DockPanelManager::setDockPanelFullContentsWhileDraggingShown(bool show)

Deprecated. Use DockPanelOptions::setDockPanelFullContentsWhileDraggingShown() instead.

void DockPanelManager::setDockPanelTransparentWhileDragging(bool transparent)

Deprecated. Use DockPanelOptions::setDockPanelTransparentWhileDragging() instead.

void DockPanelManager::setDockWindowTitle(const QString &title)

Sets a default title for the dock window.

See also dockWindowTitle().

void DockPanelManager::showDockPanel(DockWidgetPanel *widgetPanel, bool setFocus = true)

Raises dock panel panel and set focus to the first widget on it if setFocus is true.

QList<DockWidgetPanel *> DockPanelManager::widgetPanelList() const

Returns list of all widget panels that were added earlier.