BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Handles creation and appearance of docked widgets in the context of QMainWindow. More...
Classes | |
struct | DockSizeInfo |
Public Slots | |
void | dockToMinMaxSizes () |
void | setDockHeightForWidget (int height) |
A hack to request update of QDockWidget size if its child (e.g. More... | |
Public Member Functions | |
DocksController (QMainWindow *mainWindow) | |
void | addDockActionsToMenu (QMenu *menu) |
void | addWidget (int id, QWidget *widget, Qt::DockWidgetArea area) |
const 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 | 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) |
virtual bool | eventFilter (QObject *, QEvent *event) |
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 |
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.
DocksController::DocksController | ( | QMainWindow * | mainWindow | ) |
void DocksController::addDockActionsToMenu | ( | QMenu * | menu | ) |
Definition at line 225 of file DocksController.cpp.
References dockWidgets(), and m_mainWindow.
Referenced by JobView::fillViewMenu(), and SampleView::fillViewMenu().
|
private |
Definition at line 52 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 80 of file DocksController.cpp.
References addDockForWidget(), and m_docks.
Referenced by JobView::createSubWindows(), and SampleView::createSubWindows().
|
slot |
Definition at line 184 of file DocksController.cpp.
References ASSERT, DocksController::DockSizeInfo::m_dock, m_dock_info, DocksController::DockSizeInfo::m_max_size, and DocksController::DockSizeInfo::m_min_size.
Referenced by setDockHeightForWidget().
const QList< QDockWidget * > DocksController::dockWidgets | ( | ) | const |
Definition at line 138 of file DocksController.cpp.
References m_mainWindow.
Referenced by addDockActionsToMenu(), handleWindowVisibilityChanged(), resetLayout(), restoreSettings(), saveSettings(), and setTrackingEnabled().
|
privatevirtual |
Definition at line 215 of file DocksController.cpp.
References handleWindowVisibilityChanged().
QDockWidget * DocksController::findDock | ( | int | id | ) |
Definition at line 123 of file DocksController.cpp.
References ASSERT, and m_docks.
Referenced by SampleView::resetLayout(), setDockHeightForWidget(), and toggleDock().
QDockWidget * DocksController::findDock | ( | QWidget * | widget | ) |
|
private |
Definition at line 203 of file DocksController.cpp.
References dockWidgets(), and m_handleDockVisibilityChanges.
Referenced by eventFilter().
void DocksController::resetLayout | ( | ) |
Definition at line 94 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 274 of file DocksController.cpp.
References dockWidgets(), and m_mainWindow.
Referenced by restoreSettings().
void DocksController::restoreSettings | ( | const QSettings * | settings | ) |
Definition at line 255 of file DocksController.cpp.
References restoreSettings().
QHash< QString, QVariant > DocksController::saveSettings | ( | ) | const |
Definition at line 264 of file DocksController.cpp.
References dockWidgets(), and m_mainWindow.
Referenced by saveSettings().
void DocksController::saveSettings | ( | QSettings * | settings | ) | const |
Definition at line 245 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 163 of file DocksController.cpp.
References ASSERT, dockToMinMaxSizes(), findDock(), DocksController::DockSizeInfo::m_dock, m_dock_info, DocksController::DockSizeInfo::m_max_size, and DocksController::DockSizeInfo::m_min_size.
Referenced by JobView::createSubWindows(), and SampleView::createSubWindows().
|
private |
Definition at line 192 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 145 of file DocksController.cpp.
References m_docks.
Referenced by JobView::setActivity().
void DocksController::toggleDock | ( | int | id | ) |
Definition at line 117 of file DocksController.cpp.
References findDock().
Referenced by SampleView::toggleRealSpaceView().
|
private |
Definition at line 71 of file DocksController.h.
Referenced by dockToMinMaxSizes(), and setDockHeightForWidget().
|
private |
Definition at line 70 of file DocksController.h.
Referenced by addWidget(), findDock(), resetLayout(), and setVisibleDocks().
|
private |
Definition at line 72 of file DocksController.h.
Referenced by addDockForWidget(), handleWindowVisibilityChanged(), and setTrackingEnabled().
|
private |
Definition at line 69 of file DocksController.h.
Referenced by DocksController(), addDockActionsToMenu(), addDockForWidget(), dockWidgets(), resetLayout(), restoreSettings(), and saveSettings().