Ejemplo n.º 1
0
void FindReplace::SetUpFindText()
{
    Searchable* searchable = GetAvailableSearchable();

    if ( searchable )
    {
        QString selected_text = searchable->GetSelectedText();

        if ( !selected_text.isEmpty() ) 
        {
		    if ( m_RegexOptionAutoTokenise && GetSearchMode() == FindReplace::SearchMode_Regex ) {
			    selected_text = TokeniseForRegex( selected_text, false );
		    }
		    // We want to make the text selected in the editor
		    // as the default search text, but only if it's not "too long"
		    if ( selected_text.length() < MAXIMUM_SELECTED_TEXT_LIMIT ) {
                ui.cbFind->setEditText( selected_text );
            }
        }
    }

    // Find text should be selected by default
    ui.cbFind->lineEdit()->selectAll();

    SetFocus();
}