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

Dialog for searching text in the editor. More...

#include <PFindDialog.h>

Inheritance diagram for PFindDialog:
Collaboration diagram for PFindDialog:

Public Member Functions

 PFindDialog (PFindReplaceData *data, const bool selection, QWidget *parent=nullptr)
 Constructs and initializes the find dialog.
 
virtual ~PFindDialog ()
 Virtual destructor.
 
virtual PFindReplaceDatagetData ()
 Retrieves the search parameters from the dialog.
 

Protected Slots

virtual void onFindTextAvailable (const QString &text)
 Slot called when the find text changes.
 

Private Attributes

PFindReplaceDatafData
 Pointer to the find/replace data structure for storing search parameters.
 

Detailed Description

Dialog for searching text in the editor.

This class implements a modal dialog that allows users to search for text within the current msr file. The dialog provides various search options and stores the search parameters in a PFindReplaceData structure.

Search Options:
  • Case sensitive matching
  • Whole words only matching
  • Search from cursor position or document start
  • Forward or backward search direction
  • Search within selected text only (when text is selected)
UI Elements:
The dialog UI is defined in PFindDialog.ui and includes:
  • A combo box (fFind_comboBox) for entering and selecting search text
  • Checkboxes for search options
  • Find and Cancel buttons
Usage:
data.findText = "searchterm";
PFindDialog dialog(&data, hasSelection, this);
if (dialog.exec() == QDialog::Accepted) {
PFindReplaceData *result = dialog.getData();
// Perform search with result->findText
}
PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent=nullptr)
Constructs and initializes the find dialog.
Configuration structure for find and replace operations.
Definition musredit.h:109
QString findText
Text pattern to search for in the document.
Definition musredit.h:110
See also
PReplaceDialog For combined find and replace functionality
PFindReplaceData For the structure storing search parameters

Definition at line 88 of file PFindDialog.h.

Constructor & Destructor Documentation

◆ PFindDialog()

PFindDialog::PFindDialog ( PFindReplaceData * data,
const bool selection,
QWidget * parent = nullptr )

Constructs and initializes the find dialog.

Sets up the find dialog UI and initializes all controls with values from the provided data structure. The dialog is created as modal.

The constructor performs the following initialization:

  1. Sets up the UI from the .ui file
  2. Disables the Find button if no search text is provided
  3. Disables the "Selected text" option if no text is selected in the editor
  4. Populates all controls with values from the data structure
Parameters
dataPointer to a PFindReplaceData structure containing initial search parameters and receiving the user's selections on dialog close.
selectionIf true, text is currently selected in the editor and the "search in selection" option is enabled; if false, the option is disabled and unchecked.
parentPointer to the parent widget (typically the main editor window).

Definition at line 71 of file PFindDialog.cpp.

◆ ~PFindDialog()

virtual PFindDialog::~PFindDialog ( )
inlinevirtual

Virtual destructor.

Definition at line 98 of file PFindDialog.h.

Member Function Documentation

◆ getData()

PFindReplaceData * PFindDialog::getData ( )
virtual

Retrieves the search parameters from the dialog.

Extracts the current values from all dialog controls and updates the PFindReplaceData structure. This method should be called after the dialog is accepted to retrieve the user's search settings.

The following values are extracted:

  • findText: The text to search for
  • caseSensitive: Whether to match case
  • wholeWordsOnly: Whether to match whole words only
  • fromCursor: Whether to start search from cursor position
  • findBackwards: Whether to search backwards
  • selectedText: Whether to search only within selected text (if enabled)
Returns
Pointer to the updated PFindReplaceData structure containing all search parameters as set by the user.

Definition at line 119 of file PFindDialog.cpp.

◆ onFindTextAvailable

void PFindDialog::onFindTextAvailable ( const QString & text)
protectedvirtualslot

Slot called when the find text changes.

Slot to enable/disable the Find button based on search text availability.

Parameters
textThe current text in the find combo box (unused, reads from widget directly).

This slot is connected to the text changed signal of the find combo box. It enables the Find button only when there is text to search for, preventing empty searches.

Parameters
textThe current text in the combo box (parameter unused; the method reads directly from the widget to handle all input scenarios).

Definition at line 143 of file PFindDialog.cpp.

Member Data Documentation

◆ fData

PFindReplaceData* PFindDialog::fData
private

Pointer to the find/replace data structure for storing search parameters.

Definition at line 110 of file PFindDialog.h.


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