Mudlet  0
Mudclient
exitstreewidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2012 by Vadim Peretokin - vperetokin@gmail.com *
3  * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
21 
22 #include "exitstreewidget.h"
23 
24 #include "pre_guard.h"
25 #include <QtEvents>
26 #include "post_guard.h"
27 
28 
30 {
31  setSelectionMode(QAbstractItemView::ExtendedSelection);
32  setUniformRowHeights(true);
33 }
34 
35 void ExitsTreeWidget::keyPressEvent(QKeyEvent* event)
36 {
37  if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
38  closePersistentEditor(currentItem(), 1);
39  closePersistentEditor(currentItem(), 2);
40  }
41  if (event->key() == Qt::Key_Delete && hasFocus()) {
42  QList<QTreeWidgetItem*> selection = selectedItems();
43  foreach (QTreeWidgetItem* item, selection) {
44  takeTopLevelItem(indexOfTopLevelItem(item));
45  }
46  }
47 }
ExitsTreeWidget(QWidget *pW)
void keyPressEvent(QKeyEvent *event) override