Class that manages the widgets inside a QDockWidget. More...
#include <DockWindowManager.h>
Public Member Functions | |
QDockWidget * | addDockWindow (const char *name, QWidget *widget, Qt::DockWidgetArea pos=Qt::AllDockWidgetAreas) |
Adds a new dock window to the main window and embeds the given widget. | |
QWidget * | getDockWindow (const char *name) const |
Returns the widget inside the dock window by name. | |
QList< QWidget * > | getDockWindows () const |
Returns a list of all widgets inside the dock windows. | |
Static Public Member Functions | |
static void | destruct () |
static DockWindowManager * | instance () |
Creates the only instance of the DockWindowManager. | |
without deleting it. | |
Removes the specified dock window with name | |
bool | registerDockWindow (const char *name, QWidget *widget) |
Appends a new widget with name to the list of available dock widgets. | |
void | removeDockWindow (QWidget *dock) |
Method provided for convenience. | |
QWidget * | removeDockWindow (const char *name) |
void | retranslate () |
Sets the window title for the dockable windows. | |
void | saveState () |
void | setup (DockWindowItems *) |
Sets up the dock windows of the activated workbench. |
Class that manages the widgets inside a QDockWidget.
Definition at line 60 of file DockWindowManager.h.
QDockWidget * DockWindowManager::addDockWindow | ( | const char * | name, | |
QWidget * | widget, | |||
Qt::DockWidgetArea | pos = Qt::AllDockWidgetAreas | |||
) |
Adds a new dock window to the main window and embeds the given widget.
Definition at line 128 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows, draftlibs::fcgeo::connect(), and Gui::getMainWindow().
Referenced by Gui::Dialog::DlgDisplayPropertiesImp::DlgDisplayPropertiesImp(), Gui::Dialog::DockablePlacement::DockablePlacement(), MeshGui::DockEvaluateMeshImp::DockEvaluateMeshImp(), and setup().
void DockWindowManager::destruct | ( | void | ) | [static] |
Definition at line 108 of file DockWindowManager.cpp.
QWidget * DockWindowManager::getDockWindow | ( | const char * | name | ) | const |
Returns the widget inside the dock window by name.
If it does not exist 0 is returned.
Definition at line 168 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows.
Referenced by Gui::Dialog::DlgGeneralImp::DlgGeneralImp().
QList< QWidget * > DockWindowManager::getDockWindows | ( | ) | const |
Returns a list of all widgets inside the dock windows.
Definition at line 181 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows.
DockWindowManager * DockWindowManager::instance | ( | void | ) | [static] |
Creates the only instance of the DockWindowManager.
Definition at line 101 of file DockWindowManager.cpp.
Referenced by Gui::Dialog::DockablePlacement::accept(), Gui::Workbench::activate(), Gui::Dialog::DlgDisplayPropertiesImp::DlgDisplayPropertiesImp(), Gui::Dialog::DlgGeneralImp::DlgGeneralImp(), Gui::Dialog::DockablePlacement::DockablePlacement(), Gui::MainWindow::MainWindow(), Gui::Dialog::DockablePlacement::reject(), Gui::Workbench::retranslate(), and Gui::MainWindow::saveWindowSettings().
bool DockWindowManager::registerDockWindow | ( | const char * | name, | |
QWidget * | widget | |||
) |
Appends a new widget with name to the list of available dock widgets.
The caller must make sure that the name is unique. If a widget with this name is already registered nothing is done but false is returned, otherwise it is appended and true is returned.
As default the following widgets are already registered:
To avoid name clashes the caller should use names of the form module_widgettype, i. e. if a analyse dialog for the mesh module is added the name must then be Mesh_AnalyzeDialog.
To make use of dock windows when a workbench gets loaded the method setupDockWindows() must reimplemented in a subclass of Gui::Workbench.
Definition at line 269 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockWindows.
Referenced by Gui::MainWindow::MainWindow().
void DockWindowManager::removeDockWindow | ( | QWidget * | widget | ) |
Method provided for convenience.
Does basically the same as the method above unless that it accepts a pointer.
Definition at line 220 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows, and Gui::getMainWindow().
QWidget * DockWindowManager::removeDockWindow | ( | const char * | name | ) |
Definition at line 192 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows, and Gui::getMainWindow().
Referenced by Gui::Dialog::DockablePlacement::accept(), MeshGui::DockEvaluateMeshImp::closeEvent(), and Gui::Dialog::DockablePlacement::reject().
void DockWindowManager::retranslate | ( | ) |
Sets the window title for the dockable windows.
Definition at line 243 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows.
Referenced by Gui::Workbench::retranslate().
void DockWindowManager::saveState | ( | ) |
Definition at line 356 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows, Gui::DockWindowManagerP::_dockWindowItems, Gui::DockWindowItems::dockWidgets(), App::GetApplication(), ParameterGrp::GetGroup(), and App::Application::GetUserParameter().
Referenced by Gui::MainWindow::saveWindowSettings(), and setup().
void DockWindowManager::setup | ( | DockWindowItems * | items | ) |
Sets up the dock windows of the activated workbench.
Definition at line 280 of file DockWindowManager.cpp.
References Gui::DockWindowManagerP::_dockedWindows, Gui::DockWindowManagerP::_dockWindowItems, Gui::DockWindowManagerP::_dockWindows, addDockWindow(), Gui::DockWindowItems::dockWidgets(), App::GetApplication(), ParameterGrp::GetGroup(), Gui::getMainWindow(), App::Application::GetUserParameter(), RobotExample::pos, and saveState().
Referenced by Gui::Workbench::activate().