DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExp::QModuleWidget Class Reference

Window class for Qt-based user interfaces belonging to DynExp modules. User interface Qt window classes belonging to a module derived from ModuleBase have to derive from this class. More...

+ Inheritance diagram for DynExp::QModuleWidget:

Public Member Functions

 QModuleWidget (QModuleBase &Owner, QWidget *Parent=nullptr)
 Constructs a QModuleWidget instance. More...
 
 ~QModuleWidget ()=default
 
const auto & GetOwner () const noexcept
 Getter for the owning module. More...
 
Qt::WindowFlags GetQtWindowFlags () const noexcept
 Depending on thr return value of AllowResize(), returns either the return value of GetQtWindowFlagsResizable() or GetQtWindowFlagsNonResizable(). More...
 
std::string GetDataSaveDirectory () const
 Recalls a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to recall the directory the user has chosen last for saving a file. This directory is the same across all modules. More...
 
void SetDataSaveDirectory (std::string_view Directory) const
 Sets a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to store the directory the user has chosen last for saving a file. This directory is the same across all modules. More...
 
Override

Override by derived classes.

virtual bool AllowResize () const noexcept
 Indicates the resizing behavior of the user interface window. Override to adjust. More...
 

Static Public Member Functions

constexpr static Qt::WindowFlags GetQtWindowFlagsResizable ()
 Default Qt window flags for resizable module windows. More...
 
constexpr static Qt::WindowFlags GetQtWindowFlagsNonResizable ()
 Default Qt window flags for non-resizable module windows. More...
 

Private Slots

void OnDockWindow ()
 Qt slot called when DockWindowShortcut is activated, calls QModuleBase::DockUndockWindow(). More...
 
void OnFocusWindow ()
 Qt slot called when QModuleBase::ModuleWindowFocusAction is triggered, calls QModuleBase::SetFocus(). More...
 
void OnFocusMainWindow ()
 Qt slot called when FocusMainWindowShortcut is activated, calls QModuleBase::FocusMainWindow(). More...
 

Private Member Functions

void EnableDockWindowShortcut (bool Enable) noexcept
 Enables/disables DockWindowShortcut. More...
 
virtual void closeEvent (QCloseEvent *Event) override
 Qt event indicating that the module window is closed. Asks the user whether to terminate the module. This Qt event is only triggered when the module window is contained in DynExpManager's QMdiArea. More...
 

Private Attributes

QModuleBaseOwner
 Module owning this user interface window (reference, because it should never change nor be nullptr). More...
 
DynExpManagerDynExpMgr
 DynExp's main window (pointer, because it is set later by QModuleBase::InitUI()). More...
 
QShortcut * DockWindowShortcut
 Shortcut (Ctrl + D) to dock/undock a module window to/from DynExp's main window. More...
 
QShortcut * FocusMainWindowShortcut
 Shortcut (Ctrl + 0) to activate/focus DynExp's main window. More...
 

Friends

class QModuleBase
 

Detailed Description

Window class for Qt-based user interfaces belonging to DynExp modules. User interface Qt window classes belonging to a module derived from ModuleBase have to derive from this class.

Definition at line 1078 of file Module.h.

Constructor & Destructor Documentation

◆ QModuleWidget()

DynExp::QModuleWidget::QModuleWidget ( QModuleBase Owner,
QWidget *  Parent = nullptr 
)

Constructs a QModuleWidget instance.

Parameters
OwnerModule owning this user interface window.
ParentParent Qt widget of this user interface window. There is no need to pass anything else than nullptr here.

Definition at line 417 of file Module.cpp.

◆ ~QModuleWidget()

DynExp::QModuleWidget::~QModuleWidget ( )
default

Member Function Documentation

◆ AllowResize()

virtual bool DynExp::QModuleWidget::AllowResize ( ) const
inlinevirtualnoexcept

Indicates the resizing behavior of the user interface window. Override to adjust.

Returns
Return true when the window should be resizable by the user, false otherwise.

Reimplemented in DynExpModule::Widefield::WidefieldMicroscopeWidget, DynExpModule::Trajectory1DWidget, DynExpModule::SpectrumViewer::SpectrumViewerWidget, DynExpModule::SignalPlotterWidget, DynExpModule::SignalDesignerWidget, DynExpModule::ODMR::ODMRWidget, DynExpModule::LockinAmplifierControlWidget, and DynExpModule::ImageViewer::ImageViewerWidget.

Definition at line 1121 of file Module.h.

◆ closeEvent()

void DynExp::QModuleWidget::closeEvent ( QCloseEvent *  Event)
overrideprivatevirtual

Qt event indicating that the module window is closed. Asks the user whether to terminate the module. This Qt event is only triggered when the module window is contained in DynExpManager's QMdiArea.

Parameters
EventRefer to Qt documentation.

Definition at line 446 of file Module.cpp.

◆ EnableDockWindowShortcut()

void DynExp::QModuleWidget::EnableDockWindowShortcut ( bool  Enable)
privatenoexcept

Enables/disables DockWindowShortcut.

Parameters
EnablePass true to enable DockWindowShortcut, false to disable DockWindowShortcut.

Definition at line 441 of file Module.cpp.

◆ GetDataSaveDirectory()

std::string DynExp::QModuleWidget::GetDataSaveDirectory ( ) const

Recalls a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to recall the directory the user has chosen last for saving a file. This directory is the same across all modules.

Returns
Path to show by default in the modules' file open/save dialogs.

Definition at line 431 of file Module.cpp.

◆ GetOwner()

const auto& DynExp::QModuleWidget::GetOwner ( ) const
inlinenoexcept

Getter for the owning module.

Returns
Returns Owner.

Definition at line 1111 of file Module.h.

◆ GetQtWindowFlags()

Qt::WindowFlags DynExp::QModuleWidget::GetQtWindowFlags ( ) const
noexcept

Depending on thr return value of AllowResize(), returns either the return value of GetQtWindowFlagsResizable() or GetQtWindowFlagsNonResizable().

Returns
Returns a combination of Qt::WindowFlags.

Definition at line 426 of file Module.cpp.

◆ GetQtWindowFlagsNonResizable()

constexpr Qt::WindowFlags DynExp::QModuleWidget::GetQtWindowFlagsNonResizable ( )
staticconstexpr

Default Qt window flags for non-resizable module windows.

Returns
Returns a combination of Qt::WindowFlags.

Definition at line 411 of file Module.cpp.

◆ GetQtWindowFlagsResizable()

constexpr Qt::WindowFlags DynExp::QModuleWidget::GetQtWindowFlagsResizable ( )
staticconstexpr

Default Qt window flags for resizable module windows.

Returns
Returns a combination of Qt::WindowFlags.

Definition at line 405 of file Module.cpp.

◆ OnDockWindow

void DynExp::QModuleWidget::OnDockWindow ( )
privateslot

Qt slot called when DockWindowShortcut is activated, calls QModuleBase::DockUndockWindow().

Definition at line 462 of file Module.cpp.

◆ OnFocusMainWindow

void DynExp::QModuleWidget::OnFocusMainWindow ( )
privateslot

Qt slot called when FocusMainWindowShortcut is activated, calls QModuleBase::FocusMainWindow().

Definition at line 472 of file Module.cpp.

◆ OnFocusWindow

void DynExp::QModuleWidget::OnFocusWindow ( )
privateslot

Qt slot called when QModuleBase::ModuleWindowFocusAction is triggered, calls QModuleBase::SetFocus().

Definition at line 467 of file Module.cpp.

◆ SetDataSaveDirectory()

void DynExp::QModuleWidget::SetDataSaveDirectory ( std::string_view  Directory) const

Sets a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to store the directory the user has chosen last for saving a file. This directory is the same across all modules.

Parameters
DirectoryPath to show by default in the modules' file open/save dialogs.

Definition at line 436 of file Module.cpp.

Friends And Related Function Documentation

◆ QModuleBase

friend class QModuleBase
friend

Definition at line 1082 of file Module.h.

Member Data Documentation

◆ DockWindowShortcut

QShortcut* DynExp::QModuleWidget::DockWindowShortcut
private

Shortcut (Ctrl + D) to dock/undock a module window to/from DynExp's main window.

Definition at line 1165 of file Module.h.

◆ DynExpMgr

DynExpManager* DynExp::QModuleWidget::DynExpMgr
private

DynExp's main window (pointer, because it is set later by QModuleBase::InitUI()).

Definition at line 1163 of file Module.h.

◆ FocusMainWindowShortcut

QShortcut* DynExp::QModuleWidget::FocusMainWindowShortcut
private

Shortcut (Ctrl + 0) to activate/focus DynExp's main window.

Definition at line 1166 of file Module.h.

◆ Owner

QModuleBase& DynExp::QModuleWidget::Owner
private

Module owning this user interface window (reference, because it should never change nor be nullptr).

Definition at line 1162 of file Module.h.


The documentation for this class was generated from the following files: