Revision 1791

trunk/client/gui_qt/WidgetDownloadQueue.cpp (revision 1791)
2 2
#include 
3 3
#include 
4 4
#include 
5
#include 
5 6

                
6 7
#include "WidgetDownloadQueue.h"
7 8
#include "ui_WidgetDownloadQueue.h"
... ...
50 51
    ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
51 52
    connect(ui->treeView, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showContextMenu(const QPoint &)));
52 53

                
54
    /* Catch the DEL key */
55
    ui->treeView->installEventFilter(this);
56

                
53 57
    /* Add custom fields to the list */
54 58
    ui->treeView->setColumnHidden(DownloadQueueItem::FIELD_PROGRESS, true);
55 59
    ui->treeView->setColumnHidden(DownloadQueueItem::FIELD_FILE_SIZE, true);
... ...
91 95
    }
92 96
}
93 97

                
98
bool WidgetDownloadQueue::eventFilter(QObject *watched, QEvent *e)
99
{
100
    if (watched == ui->treeView) {
101
        if (e->type() == QEvent::KeyPress) {
102
            QKeyEvent *keyEvent = static_cast(e);
103
            if (keyEvent->key() == Qt::Key_Delete) {
104
                actionRemoveSelectedFiles_activated();
105
                return true;
106
            }
107
        }
108
    }
109

                
110
    return QWidget::eventFilter(watched, e);
111
}
112

                
94 113
void WidgetDownloadQueue::doMoveItem(QString collection_name, QString subject, int new_position)
95 114
{
96 115
    if (subject.isNull()) {
trunk/client/gui_qt/WidgetConfig.ui (revision 1791)
44 44
      true
45 45
     
46 46
     
47
      -1
47
      0
48 48
     
49 49
     
50 50
      
trunk/client/gui_qt/WidgetDownloadQueue.h (revision 1791)
22 22

                
23 23
protected:
24 24
    void changeEvent(QEvent *e);
25
    bool eventFilter(QObject *watched, QEvent *e);
25 26

                
26 27
private:
27 28
    Ui::WidgetDownloadQueue *ui;

Also available in: Unified diff