KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
Dialog Class Referenceabstract

QDialog subclass providing logging, validation, persistence, and button-box management. More...

#include <dialog.h>

+ Inheritance diagram for Dialog:
+ Collaboration diagram for Dialog:

Public Slots

virtual void onPreferencesChanged ()
 Called when application preferences change; override to react.
 

Signals

void itemAdded (const EntityMetadata &metadata)
 Emitted after an item is added via this dialog.
 
void itemDeleted (const EntityMetadata &metadata)
 Emitted after an item is deleted via this dialog.
 
void itemUpdated (const EntityMetadata &metadata)
 Emitted after an item is updated via this dialog.
 

Public Member Functions

 Dialog (QWidget *parent=nullptr)
 Construct with an optional parent.
 
 Dialog (const QString &loggingCategory, QWidget *parent=nullptr)
 Construct with a logging category and optional parent.
 
virtual ~Dialog ()
 Destructor — closes any open log consumer.
 
bool persistPosition () const
 Return whether the dialog persists its position between sessions.
 
void setPersistPosition (bool value)
 Enable or disable position persistence.
 
bool persistSize () const
 Return whether the dialog persists its size between sessions.
 
void setPersistSize (bool value)
 Enable or disable size persistence.
 
bool restoreToParentScreen () const
 Return whether to restore to the parent screen on show.
 
void setRestoreToParentScreen (bool value)
 Enable or disable restore-to-parent-screen behaviour.
 

Protected Slots

virtual void enableAppropriateButtons ()
 Update button enabling based on current validity and dirty state.
 
virtual void stringChanged (const QString &)
 Trigger validation when a string input changes.
 
virtual void intChanged (int)
 Trigger validation when an integer input changes.
 
virtual void boolChanged (bool)
 Trigger validation when a boolean input changes.
 
virtual void voidChanged ()
 Trigger validation when a parameterless signal fires.
 

Protected Member Functions

void performLayout ()
 Perform layout and button-box wiring; call from the subclass constructor.
 
bool isValid () const
 Return whether the current form state is valid.
 
void setValid (bool value)
 Set the form validity state and update button enabling accordingly.
 
bool isDirty () const
 Return whether the form has unsaved changes.
 
void setDirty (bool value)
 Set the dirty flag.
 
bool formLoadFailed () const
 Return whether the form failed to load.
 
void setFormLoadFailed (bool value)
 Set the form load failure flag.
 
bool formLoadComplete () const
 Return whether the form has finished loading.
 
void setApplyEnabled (bool value)
 Enable or disable the Apply button.
 
void setCancelEnabled (bool value)
 Enable or disable the Cancel button.
 
void setOkEnabled (bool value)
 Enable or disable the OK button.
 
void setStatusBarVisible (bool value)
 Show or hide the status bar.
 
void setLogHookEnabled (bool enabled)
 Enable or disable the log consumer hook for this dialog.
 
void connectValidationSignals ()
 Connect all child input widget signals to the validation slots.
 
void setChildInputWidgetsEnabled (QWidget *widget, bool enabled)
 Enable or disable all input child widgets of a given widget.
 
QColor defaultTextColor () const
 Return the default text color from the current palette.
 
QSize defaultSize () const
 Return the default dialog size.
 
void setDefaultSize (const QSize &value)
 Set the default dialog size.
 
void setDefaultSize (int width, int height)
 Set the default dialog size by width and height.
 
QDialogButtonBox * buttonBox () const
 Return the dialog button box.
 
QStatusBar * statusBar () const
 Return the dialog status bar.
 
virtual void validate ()=0
 Implement to validate the form and call setValid()/setDirty().
 
virtual void loggedItem (const Log::LogEntry &entry)
 Called when a log entry is delivered (no-op by default).
 
bool compare (const QString &a, const QString &b)
 Return true if a != b (used with COMPARE macro).
 
bool compare (const QUuid &a, const QUuid &b)
 Return true if a != b (used with COMPARE macro).
 
bool compare (const QList< QUuid > &a, const QList< QUuid > &b)
 Return true if a != b (used with COMPARE macro).
 
bool compare (const int a, int b)
 Return true if a != b (used with COMPARE macro).
 
bool compare (const TimeSpan &a, const TimeSpan &b)
 Return true if a != b (used with COMPARE macro).
 
virtual void okClicked ()
 Called when the OK button is clicked (no-op by default).
 
virtual void applyClicked ()
 Called when the Apply button is clicked (no-op by default).
 
virtual void cancelClicked ()
 Called when the Cancel button is clicked (no-op by default).
 
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

QDialog subclass providing logging, validation, persistence, and button-box management.

Dialog wires common input widget signals to validate(), manages OK/Apply/Cancel button enabling, optionally persists window position and size, and provides a built-in QStatusBar. Subclasses must implement validate().

Definition at line 31 of file dialog.h.

Constructor & Destructor Documentation

◆ Dialog()

Dialog::Dialog ( 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

◆ applyClicked()

virtual void Dialog::applyClicked ( )
inlineprotectedvirtual

Called when the Apply button is clicked (no-op by default).

Definition at line 231 of file dialog.h.

◆ buttonBox()

QDialogButtonBox * Dialog::buttonBox ( ) const
inlineprotected

Return the dialog button box.

Returns
Pointer to the QDialogButtonBox

Definition at line 200 of file dialog.h.

◆ cancelClicked()

virtual void Dialog::cancelClicked ( )
inlineprotectedvirtual

Called when the Cancel button is clicked (no-op by default).

Definition at line 233 of file dialog.h.

◆ compare() [1/5]

bool Dialog::compare ( const int  a,
int  b 
)
inlineprotected

Return true if a != b (used with COMPARE macro).

Definition at line 224 of file dialog.h.

◆ compare() [2/5]

bool Dialog::compare ( const QList< QUuid > &  a,
const QList< QUuid > &  b 
)
inlineprotected

Return true if a != b (used with COMPARE macro).

Definition at line 222 of file dialog.h.

◆ compare() [3/5]

bool Dialog::compare ( const QString &  a,
const QString &  b 
)
inlineprotected

Return true if a != b (used with COMPARE macro).

Definition at line 218 of file dialog.h.

◆ compare() [4/5]

bool Dialog::compare ( const QUuid &  a,
const QUuid &  b 
)
inlineprotected

Return true if a != b (used with COMPARE macro).

Definition at line 220 of file dialog.h.

◆ compare() [5/5]

bool Dialog::compare ( const TimeSpan &  a,
const TimeSpan &  b 
)
inlineprotected

Return true if a != b (used with COMPARE macro).

Definition at line 226 of file dialog.h.

◆ defaultSize()

QSize Dialog::defaultSize ( ) const
inlineprotected

Return the default dialog size.

Returns
Default QSize

Definition at line 181 of file dialog.h.

◆ defaultTextColor()

QColor Dialog::defaultTextColor ( ) const
inlineprotected

Return the default text color from the current palette.

Returns
Default text QColor

Definition at line 175 of file dialog.h.

◆ formLoadComplete()

bool Dialog::formLoadComplete ( ) const
inlineprotected

Return whether the form has finished loading.

Returns
true if form load is complete

Definition at line 129 of file dialog.h.

◆ formLoadFailed()

bool Dialog::formLoadFailed ( ) const
inlineprotected

Return whether the form failed to load.

Returns
true if form load failed

Definition at line 117 of file dialog.h.

◆ isDirty()

bool Dialog::isDirty ( ) const
inlineprotected

Return whether the form has unsaved changes.

Returns
true if the form is dirty

Definition at line 105 of file dialog.h.

◆ isValid()

bool Dialog::isValid ( ) const
inlineprotected

Return whether the current form state is valid.

Returns
true if validate() last set the state to valid

Definition at line 93 of file dialog.h.

◆ loggedItem()

virtual void Dialog::loggedItem ( const Log::LogEntry &  entry)
inlineprotectedvirtual

Called when a log entry is delivered (no-op by default).

Parameters
entryThe log entry

Definition at line 215 of file dialog.h.

◆ okClicked()

virtual void Dialog::okClicked ( )
inlineprotectedvirtual

Called when the OK button is clicked (no-op by default).

Definition at line 229 of file dialog.h.

◆ persistPosition()

bool Dialog::persistPosition ( ) const
inline

Return whether the dialog persists its position between sessions.

Returns
true if position persistence is enabled

Definition at line 53 of file dialog.h.

◆ persistSize()

bool Dialog::persistSize ( ) const
inline

Return whether the dialog persists its size between sessions.

Returns
true if size persistence is enabled

Definition at line 65 of file dialog.h.

◆ restoreToParentScreen()

bool Dialog::restoreToParentScreen ( ) const
inline

Return whether to restore to the parent screen on show.

Returns
true if restore-to-parent-screen is enabled

Definition at line 77 of file dialog.h.

◆ setApplyEnabled()

void Dialog::setApplyEnabled ( bool  value)
protected

Enable or disable the Apply button.

Parameters
valuetrue to enable

◆ setCancelEnabled()

void Dialog::setCancelEnabled ( bool  value)
protected

Enable or disable the Cancel button.

Parameters
valuetrue to enable

◆ setChildInputWidgetsEnabled()

void Dialog::setChildInputWidgetsEnabled ( QWidget *  widget,
bool  enabled 
)
protected

Enable or disable all input child widgets of a given widget.

Parameters
widgetParent widget whose children to enable/disable
enabledtrue to enable

◆ setDefaultSize() [1/2]

void Dialog::setDefaultSize ( const QSize &  value)
inlineprotected

Set the default dialog size.

Parameters
valueDefault QSize

Definition at line 187 of file dialog.h.

◆ setDefaultSize() [2/2]

void Dialog::setDefaultSize ( int  width,
int  height 
)
inlineprotected

Set the default dialog size by width and height.

Parameters
widthDefault width in pixels
heightDefault height in pixels

Definition at line 194 of file dialog.h.

◆ setDirty()

void Dialog::setDirty ( bool  value)
protected

Set the dirty flag.

Parameters
valuetrue if the form has unsaved changes

◆ setFormLoadFailed()

void Dialog::setFormLoadFailed ( bool  value)
inlineprotected

Set the form load failure flag.

Parameters
valuetrue if form load failed

Definition at line 123 of file dialog.h.

◆ setLogHookEnabled()

void Dialog::setLogHookEnabled ( bool  enabled)
protected

Enable or disable the log consumer hook for this dialog.

Parameters
enabledtrue to enable

◆ setOkEnabled()

void Dialog::setOkEnabled ( bool  value)
protected

Enable or disable the OK button.

Parameters
valuetrue to enable

◆ setPersistPosition()

void Dialog::setPersistPosition ( bool  value)
inline

Enable or disable position persistence.

Parameters
valuetrue to persist position

Definition at line 59 of file dialog.h.

◆ setPersistSize()

void Dialog::setPersistSize ( bool  value)
inline

Enable or disable size persistence.

Parameters
valuetrue to persist size

Definition at line 71 of file dialog.h.

◆ setRestoreToParentScreen()

void Dialog::setRestoreToParentScreen ( bool  value)
inline

Enable or disable restore-to-parent-screen behaviour.

Parameters
valuetrue to restore to the parent screen

Definition at line 83 of file dialog.h.

◆ setStatusBarVisible()

void Dialog::setStatusBarVisible ( bool  value)
protected

Show or hide the status bar.

Parameters
valuetrue to show

◆ setValid()

void Dialog::setValid ( bool  value)
protected

Set the form validity state and update button enabling accordingly.

Parameters
valuetrue if the form is valid

◆ statusBar()

QStatusBar * Dialog::statusBar ( ) const
inlineprotected

Return the dialog status bar.

Returns
Pointer to the QStatusBar

Definition at line 206 of file dialog.h.


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