musredit 1.0.0
Loading...
Searching...
No Matches
PGetParameterBlockDialog Class Reference

Dialog for creating FITPARAMETER blocks in msr files. More...

#include <PGetParameterBlockDialog.h>

Inheritance diagram for PGetParameterBlockDialog:
Collaboration diagram for PGetParameterBlockDialog:

Public Member Functions

 PGetParameterBlockDialog (const QString helpUrl)
 Constructs the FITPARAMETER block dialog.
 
QString getParams ()
 Returns all entered parameters as formatted text.
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *ev)
 Event filter to handle keyboard shortcuts.
 

Private Slots

void paramAdd ()
 Validates and adds a parameter to the FITPARAMETER block.
 
void helpContent ()
 Opens the online help for FITPARAMETER blocks.
 

Private Attributes

QString fHelpUrl
 URL to the online documentation for FITPARAMETER blocks.
 

Detailed Description

Dialog for creating FITPARAMETER blocks in msr files.

This dialog allows users to define fit parameters for musrfit. Each parameter consists of a number, name, initial value, step size, and optional lower/upper boundaries. Parameters are formatted with proper column alignment for the msr file format.

Parameter Fields:
  • No: Parameter number (auto-incremented)
  • Name: Parameter name (required, max ~12 chars for alignment)
  • Value: Initial parameter value (required)
  • Step: Initial step size for minimizer (required)
  • Lower: Lower boundary ("none" or numeric value)
  • Upper: Upper boundary ("none" or numeric value)
Generated Output Format:
The dialog generates properly formatted FITPARAMETER lines:
FITPARAMETER
1 alpha 1.0 0.01 none
2 beta 0.5 0.001 none 0.0 1.0
3 frequency 10.5 0.1 none
User Interaction:
  • Press Return/Enter key to quickly add parameters
  • Parameter number auto-increments after each addition
  • Input fields are reset after adding a parameter
  • Focus returns to the Name field for rapid entry
See also
PGetFunctionsBlockDialog For defining functions using these parameters

Definition at line 87 of file PGetParameterBlockDialog.h.

Constructor & Destructor Documentation

◆ PGetParameterBlockDialog()

PGetParameterBlockDialog::PGetParameterBlockDialog ( const QString helpUrl)

Constructs the FITPARAMETER block dialog.

Initializes the dialog UI, sets up input validators for numeric fields, and installs an event filter to capture keyboard shortcuts. The dialog is created as modal. A monospace font (Courier, 10pt) is used for the parameter display to ensure proper column alignment.

Input Validators:
  • Double validators: parameter value and step size
Event Filter:
An event filter is installed to intercept the Return key, allowing users to quickly add parameters by pressing Enter instead of clicking the Add button.
Parameters
helpUrlURL to the online documentation for FITPARAMETER blocks.

Definition at line 73 of file PGetParameterBlockDialog.cpp.

Member Function Documentation

◆ eventFilter()

bool PGetParameterBlockDialog::eventFilter ( QObject * obj,
QEvent * ev )
protected

Event filter to handle keyboard shortcuts.

Event filter to intercept keyboard events.

Intercepts the Return key to trigger parameter addition, allowing for rapid parameter entry without clicking the Add button.

Parameters
objThe object that generated the event.
evThe event to be filtered.
Returns
true if the event was handled (Return key), false otherwise.

Filters keyboard events to intercept the Return/Enter key press. When Return is pressed, the current parameter values are validated and added to the parameter list via paramAdd(). This allows for rapid parameter entry without using the mouse to click the Add button.

Parameters
objPointer to the object that generated the event.
evPointer to the event to be filtered.
Returns
true if the event was handled (Return key was pressed and parameter was added), false otherwise (event is passed to the base class).

Definition at line 103 of file PGetParameterBlockDialog.cpp.

◆ getParams()

QString PGetParameterBlockDialog::getParams ( )
inline

Returns all entered parameters as formatted text.

Returns
Complete FITPARAMETER block content ready for insertion into an msr file.

Definition at line 99 of file PGetParameterBlockDialog.h.

◆ helpContent

void PGetParameterBlockDialog::helpContent ( )
privateslot

Opens the online help for FITPARAMETER blocks.

Opens the online help documentation for FITPARAMETER blocks.

Attempts to open the help URL in the system's default web browser using QDesktopServices. If the URL is empty, displays an informational message. If the browser fails to open, displays an error message with a clickable link.

Definition at line 280 of file PGetParameterBlockDialog.cpp.

◆ paramAdd

void PGetParameterBlockDialog::paramAdd ( )
privateslot

Validates and adds a parameter to the FITPARAMETER block.

Collects values from all input fields, validates required fields, formats the parameter line with proper column alignment, and appends it to the parameter text display. After successful addition, the input fields are reset and focus returns to the Name field for the next parameter.

Validation Rules:
  • Parameter name is required (cannot be empty)
  • Parameter value is required (cannot be empty)
  • Parameter step is required (cannot be empty)
  • Lower boundary must be "none" or a valid double
  • Upper boundary must be "none" or a valid double
Column Formatting:
  • Parameter number: right-aligned in 10 character field
  • Name: left-aligned, padded to 13 characters
  • Value: left-aligned, padded to 10 characters
  • Step: left-aligned, padded to 10 characters
  • Positive error: always "none" (11 characters)
  • Lower boundary: left-aligned, padded to 10 characters (optional)
  • Upper boundary: left-aligned, padded to 10 characters (optional)
Post-Addition Actions:
  • Parameter number is auto-incremented
  • All input fields are cleared (boundaries reset to "none")
  • Focus moves to the Name field

Definition at line 152 of file PGetParameterBlockDialog.cpp.

Member Data Documentation

◆ fHelpUrl

QString PGetParameterBlockDialog::fHelpUrl
private

URL to the online documentation for FITPARAMETER blocks.

Definition at line 124 of file PGetParameterBlockDialog.h.


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