BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Handles creation and appearance of docked widgets in the context of QMainWindow. It is used for SampleView and JobView which are based on QMainWindow.
Definition at line 30 of file DocksController.h.
Classes | |
struct | DockSizeInfo |
Public Slots | |
void | dockToMinMaxSizes () |
void | setDockHeightForWidget (int height) |
A hack to request update of QDockWidget size if its child (e.g. InfoWidget) wants it. The problem bypassed here is that there is no direct method to QMainWindow to recalculate position of splitters surrounding given QDockWidget. So our child QWidget requests here the change of Min/Max size of QDockWidget, this will trigger recalculation of QDockWidget layout and will force QDockWidget to respect sizeHints provided by ChildWidget. Later (in one single timer shot) we return min/max sizes of QDockWidget back to re-enable splitters functionality. More... | |
Public Member Functions | |
DocksController (QMainWindow *mainWindow) | |
void | addDockActionsToMenu (QMenu *menu) |
void | addWidget (int id, QWidget *widget, Qt::DockWidgetArea area) |
QList< QDockWidget * > | dockWidgets () const |
QDockWidget * | findDock (int id) |
QDockWidget * | findDock (QWidget *widget) |
void | resetLayout () |
void | restoreSettings (const QHash< QString, QVariant > &settings) |
void | restoreSettings (const QSettings *settings) |
QHash< QString, QVariant > | saveSettings () const |
void | saveSettings (QSettings *settings) const |
void | setDockVisible (int id, bool visible=true) |
void | setVisibleDocks (const std::vector< int > &visibleDocks) |
Show docks with id's from the list. Other docks will be hidden. More... | |
void | toggleDock (int id) |
Private Member Functions | |
QDockWidget * | addDockForWidget (QWidget *widget) |
bool | eventFilter (QObject *, QEvent *event) override |
void | handleWindowVisibilityChanged (bool visible) |
void | setTrackingEnabled (bool enabled) |
Private Attributes | |
DockSizeInfo | m_dock_info |
std::map< int, DockWidgetInfo > | m_docks |
bool | m_handleDockVisibilityChanges = true |
QMainWindow * | m_mainWindow |
DocksController::DocksController | ( | QMainWindow * | mainWindow | ) |
void DocksController::addDockActionsToMenu | ( | QMenu * | menu | ) |
Definition at line 234 of file DocksController.cpp.
References dockWidgets(), and m_mainWindow.
Referenced by JobView::fillViewMenu(), and SampleView::fillViewMenu().
|
private |
Definition at line 54 of file DocksController.cpp.
References m_handleDockVisibilityChanges, and m_mainWindow.
Referenced by addWidget().
void DocksController::addWidget | ( | int | id, |
QWidget * | widget, | ||
Qt::DockWidgetArea | area | ||
) |
Definition at line 82 of file DocksController.cpp.
References addDockForWidget(), Error, and m_docks.
Referenced by SampleView::SampleView(), and JobView::createSubWindows().
|
slot |
Definition at line 194 of file DocksController.cpp.
References DocksController::DockSizeInfo::m_dock, m_dock_info, DocksController::DockSizeInfo::m_max_size, and DocksController::DockSizeInfo::m_min_size.
Referenced by setDockHeightForWidget().
QList< QDockWidget * > DocksController::dockWidgets | ( | ) | const |
Definition at line 148 of file DocksController.cpp.
References m_mainWindow.
Referenced by addDockActionsToMenu(), handleWindowVisibilityChanged(), resetLayout(), restoreSettings(), saveSettings(), and setTrackingEnabled().
|
overrideprivate |
Definition at line 224 of file DocksController.cpp.
References handleWindowVisibilityChanged().
QDockWidget * DocksController::findDock | ( | int | id | ) |
Definition at line 131 of file DocksController.cpp.
References m_docks.
Referenced by SampleView::resetLayout(), setDockHeightForWidget(), setDockVisible(), and toggleDock().
QDockWidget * DocksController::findDock | ( | QWidget * | widget | ) |
|
private |
Definition at line 213 of file DocksController.cpp.
References dockWidgets(), and m_handleDockVisibilityChanges.
Referenced by eventFilter().
void DocksController::resetLayout | ( | ) |
Definition at line 96 of file DocksController.cpp.
References dockWidgets(), m_docks, m_mainWindow, and setTrackingEnabled().
Referenced by JobView::resetLayout(), and SampleView::resetLayout().
void DocksController::restoreSettings | ( | const QHash< QString, QVariant > & | settings | ) |
Definition at line 281 of file DocksController.cpp.
References dockWidgets(), and m_mainWindow.
Referenced by restoreSettings().
void DocksController::restoreSettings | ( | const QSettings * | settings | ) |
Definition at line 263 of file DocksController.cpp.
References restoreSettings().
QHash< QString, QVariant > DocksController::saveSettings | ( | ) | const |
Definition at line 272 of file DocksController.cpp.
References dockWidgets(), and m_mainWindow.
Referenced by saveSettings().
void DocksController::saveSettings | ( | QSettings * | settings | ) | const |
Definition at line 253 of file DocksController.cpp.
References saveSettings().
|
slot |
A hack to request update of QDockWidget size if its child (e.g. InfoWidget) wants it. The problem bypassed here is that there is no direct method to QMainWindow to recalculate position of splitters surrounding given QDockWidget. So our child QWidget requests here the change of Min/Max size of QDockWidget, this will trigger recalculation of QDockWidget layout and will force QDockWidget to respect sizeHints provided by ChildWidget. Later (in one single timer shot) we return min/max sizes of QDockWidget back to re-enable splitters functionality.
Definition at line 173 of file DocksController.cpp.
References dockToMinMaxSizes(), findDock(), DocksController::DockSizeInfo::m_dock, m_dock_info, DocksController::DockSizeInfo::m_max_size, and DocksController::DockSizeInfo::m_min_size.
void DocksController::setDockVisible | ( | int | id, |
bool | visible = true |
||
) |
Definition at line 125 of file DocksController.cpp.
References findDock().
Referenced by SampleView::onRequestViewInRealSpace(), and SampleView::updateSingleSampleMode().
|
private |
Definition at line 202 of file DocksController.cpp.
References dockWidgets(), and m_handleDockVisibilityChanges.
Referenced by resetLayout().
void DocksController::setVisibleDocks | ( | const std::vector< int > & | visibleDocks | ) |
Show docks with id's from the list. Other docks will be hidden.
Definition at line 155 of file DocksController.cpp.
References m_docks.
Referenced by JobView::setActivity().
void DocksController::toggleDock | ( | int | id | ) |
Definition at line 119 of file DocksController.cpp.
References findDock().
Referenced by SampleView::toggleRealSpaceView().
|
private |
Definition at line 72 of file DocksController.h.
Referenced by dockToMinMaxSizes(), and setDockHeightForWidget().
|
private |
Definition at line 71 of file DocksController.h.
Referenced by addWidget(), findDock(), resetLayout(), and setVisibleDocks().
|
private |
Definition at line 73 of file DocksController.h.
Referenced by addDockForWidget(), handleWindowVisibilityChanged(), and setTrackingEnabled().
|
private |
Definition at line 70 of file DocksController.h.
Referenced by DocksController(), addDockActionsToMenu(), addDockForWidget(), dockWidgets(), resetLayout(), restoreSettings(), and saveSettings().