forked from qt-creator/qt-creator
Bookmarks: Handle enter and delete keys
Change-Id: I169dcc02f02a647b0a2ae6478227a852be922de2 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
fdaddec7d1
commit
905aeeadcc
@@ -219,6 +219,8 @@ BookmarkView::BookmarkView(QWidget *parent) :
|
||||
|
||||
connect(this, SIGNAL(clicked(QModelIndex)),
|
||||
this, SLOT(gotoBookmark(QModelIndex)));
|
||||
connect(this, SIGNAL(activated(QModelIndex)),
|
||||
this, SLOT(gotoBookmark(QModelIndex)));
|
||||
|
||||
ICore::addContextObject(m_bookmarkContext);
|
||||
|
||||
@@ -280,6 +282,16 @@ void BookmarkView::removeBookmark(const QModelIndex& index)
|
||||
m_manager->removeBookmark(bm);
|
||||
}
|
||||
|
||||
void BookmarkView::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Delete) {
|
||||
removeBookmark(currentIndex());
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
QListView::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void BookmarkView::removeAll()
|
||||
{
|
||||
const QString key = QLatin1String("Bookmarks.DontAskAgain");
|
||||
|
@@ -161,6 +161,7 @@ protected slots:
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
void removeBookmark(const QModelIndex &index);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
private:
|
||||
BookmarkContext *m_bookmarkContext;
|
||||
QModelIndex m_contextMenuIndex;
|
||||
|
Reference in New Issue
Block a user