DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
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...

#include <Module.h>

+ Inheritance diagram for DynExp::QModuleWidget:

Public Member Functions

 QModuleWidget (QModuleBase &Owner, QWidget *Parent=nullptr)
 Constructs a QModuleWidget instance.
 
 ~QModuleWidget ()=default
 
const auto & GetOwner () const noexcept
 Getter for the owning module.
 
Qt::WindowFlags GetQtWindowFlags () const noexcept
 Depending on thr return value of AllowResize(), returns either the return value of GetQtWindowFlagsResizable() or GetQtWindowFlagsNonResizable().
 
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.
 
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.
 
Override

Override by derived classes.

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

Static Public Member Functions

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

Private Slots

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

Private Member Functions

void EnableDockWindowShortcut (bool Enable) noexcept
 Enables/disables DockWindowShortcut.
 
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.
 

Private Attributes

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

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 1394 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 451 of file Module.cpp.

◆ ~QModuleWidget()

DynExp::QModuleWidget::~QModuleWidget ( )
default

Member Function Documentation

◆ AllowResize()

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

◆ 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 480 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 475 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 465 of file Module.cpp.

◆ GetOwner()

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

Getter for the owning module.

Returns
Returns Owner.

Definition at line 1427 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 460 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 445 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 439 of file Module.cpp.

◆ OnDockWindow

void DynExp::QModuleWidget::OnDockWindow ( )
privateslot

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

Definition at line 496 of file Module.cpp.

◆ OnFocusMainWindow

void DynExp::QModuleWidget::OnFocusMainWindow ( )
privateslot

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

Definition at line 506 of file Module.cpp.

◆ OnFocusWindow

void DynExp::QModuleWidget::OnFocusWindow ( )
privateslot

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

Definition at line 501 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 470 of file Module.cpp.

Friends And Related Symbol Documentation

◆ QModuleBase

friend class QModuleBase
friend

Definition at line 1398 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 1481 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 1479 of file Module.h.

◆ FocusMainWindowShortcut

QShortcut* DynExp::QModuleWidget::FocusMainWindowShortcut
private

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

Definition at line 1482 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 1478 of file Module.h.


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