-// Copyright (C) 2015-2016 OPEN CASCADE
+// Copyright (C) 2015-2023 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
addAction( new QAction( tr( "CASE_SENSITIVE_CHECK" ), this ) );
addAction( new QAction( tr( "WHOLE_WORDS_CHECK" ), this ) );
addAction( new QAction( tr( "REGEX_CHECK" ), this ) );
- addAction( new QAction( tr( "Find" ), this ) );
+ addAction( new QAction( QIcon( ":/images/py_find.png" ), tr( "Find" ), this ) );
addAction( new QAction( tr( "FindPrevious" ), this ) );
addAction( new QAction( tr( "FindNext" ), this ) );
- addAction( new QAction( tr( "Replace" ), this ) );
+ addAction( new QAction( QIcon( ":/images/py_replace.png" ), tr( "Replace" ), this ) );
foreach ( QAction* action, actions().mid( CaseSensitive, RegExp+1 ) )
{
}
myEditor->installEventFilter( this );
+ connect( myEditor, SIGNAL( customizeMenu( QMenu* ) ), this, SLOT( customizeMenu( QMenu* ) ) );
hide();
}
{
case Qt::Key_Escape:
if ( isVisible() )
+ {
hide();
+ return true;
+ }
break;
default:
break;
activate( Find );
}
+/*!
+ \brief Customize menu for editor.
+*/
+void PyEditor_FindTool::customizeMenu( QMenu* menu )
+{
+ menu->addSeparator();
+ menu->addAction( actions()[Find] );
+ menu->addAction( actions()[Replace] );
+}
+
/*!
\brief Slot: activate 'Replace' dialog.
*/
bindings << QKeySequence( QKeySequence::FindNext );
break;
case Replace:
- bindings << QKeySequence( QKeySequence::Replace );
bindings << QKeySequence( "Ctrl+H" );
+ bindings << QKeySequence( QKeySequence::Replace );
break;
default:
break;
QStringListModel& model = replace ? myReplaceCompletion : myFindCompletion;
QStringList completions = model.stringList();
- if ( !text.isEmpty() and !completions.contains( text ) )
+ if ( !text.isEmpty() && !completions.contains( text ) )
{
completions.prepend( text );
model.setStringList( completions );