From 4ae36329ca264f9af113e3ee329b9364c7440e7e Mon Sep 17 00:00:00 2001 From: sbh Date: Fri, 1 Feb 2013 11:42:04 +0000 Subject: [PATCH] refs #2881 Possibility of deleting shortcuts for the Search Tool added --- src/Qtx/QtxSearchTool.cxx | 19 +++++++++++++++++++ src/Qtx/QtxSearchTool.h | 1 + 2 files changed, 20 insertions(+) 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; -- 2.39.2