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

Dialog for creating and editing TITLE blocks in msr files. More...

#include <PGetTitleBlockDialog.h>

Inheritance diagram for PGetTitleBlockDialog:
Collaboration diagram for PGetTitleBlockDialog:

Public Member Functions

 PGetTitleBlockDialog (const QString helpUrl)
 Constructs a dialog for entering or editing a title.
 
virtual ~PGetTitleBlockDialog ()
 Virtual destructor.
 
QString getTitle ()
 Returns the entered title text.
 

Private Slots

void helpContent ()
 Opens the online help for TITLE blocks.
 

Private Attributes

QString fHelpUrl
 URL to the online documentation for TITLE blocks.
 

Detailed Description

Dialog for creating and editing TITLE blocks in msr files.

This dialog provides a simple text input interface for entering or modifying the title of a musrfit msr file. The title serves as a descriptive label for the analysis and appears at the beginning of the msr file.

TITLE Block Format:
The TITLE block consists of a single line in the msr file:
sample_name or_measurement_description
Usage:
The dialog is accessed through the menu: Edit → Add Block → Title Block. It presents a single-line text input field where users can enter or edit the title text. The dialog is modal, requiring user interaction before returning to the main editor.
Example Titles:
  • "TF-ZF transition measurement on Cu sample at 10K"
  • "Longitudinal field scan H=0-2000G"
  • "Temperature dependence study 5-300K"
Note
The title is optional in msr files but recommended for documentation purposes.
The title should be a single line without newline characters.
See also
musredit Main editor application

Definition at line 88 of file PGetTitleBlockDialog.h.

Constructor & Destructor Documentation

◆ PGetTitleBlockDialog()

PGetTitleBlockDialog::PGetTitleBlockDialog ( const QString helpUrl)

Constructs a dialog for entering or editing a title.

Constructor - Initializes the TITLE block dialog.

Initializes the dialog with a text input field and help button. The dialog is configured as modal to ensure user interaction completion before returning to the main editor window.

Parameters
helpUrlURL string pointing to online documentation for TITLE blocks. If empty, the help button will display a placeholder message.
See also
helpContent() For the help system implementation

Sets up the user interface for the title input dialog. The dialog contains a single QLineEdit widget for text entry and standard OK/Cancel buttons. The interface is loaded from the UI definition file and configured as a modal dialog.

The dialog is designed to be simple and focused, presenting only the essential controls needed to enter or edit a title string. No complex initialization or data loading is required beyond basic UI setup.

The modal configuration ensures that users complete the title entry or explicitly cancel before returning to the main editor, preventing incomplete or ambiguous states.

Parameters
helpUrlURL string for the online help documentation. If empty, the help button will display a placeholder message instead of opening a web browser. The URL should point to documentation explaining the purpose and format of msr file titles.
Note
The dialog does not validate the title content. Validation, if needed, should be performed by the caller after retrieving the title via getTitle().
See also
setupUi() Qt Designer generated UI initialization method
setModal() Configures the dialog as modal
getTitle() Retrieves the entered title after dialog acceptance

Definition at line 79 of file PGetTitleBlockDialog.cpp.

◆ ~PGetTitleBlockDialog()

virtual PGetTitleBlockDialog::~PGetTitleBlockDialog ( )
inlinevirtual

Virtual destructor.

Default destructor implementation. Qt's parent-child ownership system handles cleanup of UI elements automatically.

Definition at line 113 of file PGetTitleBlockDialog.h.

Member Function Documentation

◆ getTitle()

QString PGetTitleBlockDialog::getTitle ( )
inline

Returns the entered title text.

Retrieves the text currently entered in the title line edit field. This method is typically called after the dialog is accepted to obtain the title string for insertion into the msr file.

Returns
QString containing the title text entered by the user. May be empty if no text was entered. The returned string is trimmed of leading/trailing whitespace by the QLineEdit widget.
Note
The caller should validate that the returned string does not contain newline characters, as msr file titles must be single-line.
See also
QLineEdit::text() For the underlying widget method

Definition at line 131 of file PGetTitleBlockDialog.h.

◆ helpContent

void PGetTitleBlockDialog::helpContent ( )
privateslot

Opens the online help for TITLE blocks.

Opens online help documentation for TITLE blocks.

Attempts to open the help URL in the system's default web browser using QDesktopServices. If the URL is empty, displays a placeholder information message. If the browser cannot be opened, shows an error dialog with the URL for manual access.

The help documentation typically covers:

  • Purpose and format of the TITLE block
  • Examples of well-formed titles
  • Best practices for title naming
Note
Connected to the help button click signal in the UI.
See also
PGetTitleBlockDialog::PGetTitleBlockDialog() Where helpUrl is set

Attempts to open the help URL in the user's default web browser using QDesktopServices::openUrl(). The help documentation typically provides:

  • Explanation of the TITLE block's purpose in msr files
  • Format specifications and constraints
  • Examples of well-formed titles for various analysis types
  • Best practices for creating informative and consistent titles

Error handling:

  • If fHelpUrl is empty: displays an information dialog with a placeholder message indicating that help documentation will be available in the future
  • If the browser fails to open: displays a critical error dialog with the URL formatted as a clickable hyperlink, allowing users to manually copy and paste the URL into their browser

The URL is parsed in TolerantMode, which allows for flexible URL formatting and automatically handles common URL variations (e.g., with or without protocol specification).

Note
This slot is connected to the help button click signal in the UI.
The dialog remains open after help is displayed, allowing users to reference the documentation while entering the title.
See also
PGetTitleBlockDialog::PGetTitleBlockDialog() Where fHelpUrl is initialized
QDesktopServices::openUrl() For the browser opening mechanism

Definition at line 115 of file PGetTitleBlockDialog.cpp.

Member Data Documentation

◆ fHelpUrl

QString PGetTitleBlockDialog::fHelpUrl
private

URL to the online documentation for TITLE blocks.

Definition at line 154 of file PGetTitleBlockDialog.h.


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