KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
MainWindowBase Class Reference

QMainWindow subclass providing logging, status bar helpers, and geometry persistence. More...

#include <mainwindowbase.h>

+ Inheritance diagram for MainWindowBase:
+ Collaboration diagram for MainWindowBase:

Public Slots

void showStatusBarMessage (const QString &text, const QColor &textColor, const TimeSpan &timeout=TimeSpan())
 Show a coloured status message with an optional timeout.
 
void showStatusBarMessage (const QString &text, const TimeSpan &timeout=TimeSpan())
 Show a default-coloured status message with an optional timeout.
 
void showStatusBarAnimatedProgressMessage (const QString &text, const QColor &textColor=QColor())
 Show an animated progress message in the status bar.
 
void stopStatusBarAnimation ()
 Stop any active status bar animation.
 
virtual void onPreferencesChanged ()
 Called when application preferences change; override to react.
 

Public Member Functions

 MainWindowBase (const QString &loggingCategory, QWidget *parent=nullptr)
 Construct with a logging category and optional parent.
 
bool persistPosition () const
 Return whether the window persists its position between sessions.
 
void setPersistPosition (bool value)
 Enable or disable position persistence.
 
bool persistSize () const
 Return whether the window persists its size between sessions.
 
void setPersistSize (bool value)
 Enable or disable size persistence.
 
int type () const
 Return the application-defined window type integer.
 
void setType (int value)
 Set the application-defined window type integer.
 
QSize defaultSize () const
 Return the default window size.
 
void setDefaultSize (const QSize &value)
 Set the default window size.
 
void setDefaultSize (int width, int height)
 Set the default window size by width and height.
 
QMdiArea * parentMdiArea ()
 Return the parent QMdiArea if this window is hosted in one.
 
StatusBarstatusBar ()
 Return the built-in StatusBar widget.
 
bool formLoadComplete () const
 Return whether the form has finished loading.
 
bool formLoadFailed () const
 Return whether the form failed to load.
 

Protected Member Functions

void initializeBase ()
 Perform base-class initialization; call from the subclass constructor.
 
void setFormLoadComplete (bool value)
 Set the form load completion flag.
 
void setFormLoadFailed (bool value)
 Set the form load failure flag.
 
virtual void moveEvent (QMoveEvent *event) override
 Persist position on move.
 
virtual void resizeEvent (QResizeEvent *event) override
 Persist size on resize.
 
virtual void showEvent (QShowEvent *event) override
 Restore geometry and complete form load on first show.
 

Detailed Description

QMainWindow subclass providing logging, status bar helpers, and geometry persistence.

MainWindowBase wires a StatusBar, persists window position/size across sessions, and exposes slots for showing plain or animated status messages. Call initializeBase() from the subclass constructor after building the UI.

Definition at line 30 of file mainwindowbase.h.

Constructor & Destructor Documentation

◆ MainWindowBase()

MainWindowBase::MainWindowBase ( const QString &  loggingCategory,
QWidget *  parent = nullptr 
)
explicit

Construct with a logging category and optional parent.

Parameters
loggingCategoryCategory name used for log output
parentOptional QWidget parent

Member Function Documentation

◆ defaultSize()

QSize MainWindowBase::defaultSize ( ) const
inline

Return the default window size.

Returns
Default QSize

Definition at line 82 of file mainwindowbase.h.

◆ formLoadComplete()

bool MainWindowBase::formLoadComplete ( ) const
inline

Return whether the form has finished loading.

Returns
true if form load is complete

Definition at line 140 of file mainwindowbase.h.

◆ formLoadFailed()

bool MainWindowBase::formLoadFailed ( ) const
inline

Return whether the form failed to load.

Returns
true if form load failed

Definition at line 146 of file mainwindowbase.h.

◆ parentMdiArea()

QMdiArea * MainWindowBase::parentMdiArea ( )

Return the parent QMdiArea if this window is hosted in one.

Returns
Pointer to the parent MdiArea, or nullptr

◆ persistPosition()

bool MainWindowBase::persistPosition ( ) const
inline

Return whether the window persists its position between sessions.

Returns
true if position persistence is enabled

Definition at line 46 of file mainwindowbase.h.

◆ persistSize()

bool MainWindowBase::persistSize ( ) const
inline

Return whether the window persists its size between sessions.

Returns
true if size persistence is enabled

Definition at line 58 of file mainwindowbase.h.

◆ setDefaultSize() [1/2]

void MainWindowBase::setDefaultSize ( const QSize &  value)
inline

Set the default window size.

Parameters
valueDefault QSize

Definition at line 88 of file mainwindowbase.h.

◆ setDefaultSize() [2/2]

void MainWindowBase::setDefaultSize ( int  width,
int  height 
)
inline

Set the default window size by width and height.

Parameters
widthDefault width in pixels
heightDefault height in pixels

Definition at line 95 of file mainwindowbase.h.

◆ setFormLoadComplete()

void MainWindowBase::setFormLoadComplete ( bool  value)
inlineprotected

Set the form load completion flag.

Parameters
valuetrue when form load is complete

Definition at line 156 of file mainwindowbase.h.

◆ setFormLoadFailed()

void MainWindowBase::setFormLoadFailed ( bool  value)
inlineprotected

Set the form load failure flag.

Parameters
valuetrue if form load failed

Definition at line 162 of file mainwindowbase.h.

◆ setPersistPosition()

void MainWindowBase::setPersistPosition ( bool  value)
inline

Enable or disable position persistence.

Parameters
valuetrue to persist position

Definition at line 52 of file mainwindowbase.h.

◆ setPersistSize()

void MainWindowBase::setPersistSize ( bool  value)
inline

Enable or disable size persistence.

Parameters
valuetrue to persist size

Definition at line 64 of file mainwindowbase.h.

◆ setType()

void MainWindowBase::setType ( int  value)
inline

Set the application-defined window type integer.

Parameters
valueWindow type value

Definition at line 76 of file mainwindowbase.h.

◆ showStatusBarAnimatedProgressMessage

void MainWindowBase::showStatusBarAnimatedProgressMessage ( const QString &  text,
const QColor &  textColor = QColor() 
)
slot

Show an animated progress message in the status bar.

Parameters
textMessage text (dots are appended periodically)
textColorForeground colour (default: palette default)

◆ showStatusBarMessage [1/2]

void MainWindowBase::showStatusBarMessage ( const QString &  text,
const QColor &  textColor,
const TimeSpan &  timeout = TimeSpan() 
)
slot

Show a coloured status message with an optional timeout.

Parameters
textMessage text
textColorForeground colour for the message
timeoutDuration before the message is cleared (default: no timeout)

◆ showStatusBarMessage [2/2]

void MainWindowBase::showStatusBarMessage ( const QString &  text,
const TimeSpan &  timeout = TimeSpan() 
)
slot

Show a default-coloured status message with an optional timeout.

Parameters
textMessage text
timeoutDuration before the message is cleared (default: no timeout)

◆ statusBar()

StatusBar * MainWindowBase::statusBar ( )

Return the built-in StatusBar widget.

Returns
Pointer to the StatusBar

◆ type()

int MainWindowBase::type ( ) const
inline

Return the application-defined window type integer.

Returns
Window type value

Definition at line 70 of file mainwindowbase.h.


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