From: sbh Date: Fri, 1 Feb 2013 11:42:04 +0000 (+0000) Subject: refs #2881 Possibility of deleting shortcuts for the Search Tool added X-Git-Tag: V5_2_5~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ae36329ca264f9af113e3ee329b9364c7440e7e;p=modules%2Fgui.git refs #2881 Possibility of deleting shortcuts for the Search Tool added --- diff --git a/src/Qtx/QtxSearchTool.cxx b/src/Qtx/QtxSearchTool.cxx index 674a91e79..0a58da5d3 100644 --- a/src/Qtx/QtxSearchTool.cxx +++ b/src/Qtx/QtxSearchTool.cxx @@ -472,6 +472,25 @@ void QtxSearchTool::setShortcuts( const QList& accels ) initShortcuts( accels ); } +/*! + \brief Delete shortcut. + \param accel shortcut bindings to be deleted + \sa shortcuts() +*/ +void QtxSearchTool::deleteShortcut( const QKeySequence& accel ) +{ + ShortcutList::Iterator it; + for ( it = myShortcuts.begin(); it != myShortcuts.end(); ++it ) + { + if ( !(*it).isNull() ) + { + QShortcut* sc = (*it); + if ( sc->key() == accel ) + delete sc; + } + } +} + /*! \brief Add custom widget. \param w custom widget to be added diff --git a/src/Qtx/QtxSearchTool.h b/src/Qtx/QtxSearchTool.h index cb2694f80..9e489b36d 100644 --- a/src/Qtx/QtxSearchTool.h +++ b/src/Qtx/QtxSearchTool.h @@ -99,6 +99,7 @@ public: QList shortcuts() const; void setShortcuts( const QKeySequence& ); void setShortcuts( const QList& ); + void deleteShortcut( const QKeySequence& ); int addCustomWidget( QWidget*, int = -1 ); QWidget* customWidget( int ) const;