123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /*
- * HistoryLineEdit.cpp
- * nirc
- *
- * Created by Niklas Bölter on 03.02.10.
- * Copyright 2010 Frubar Corporation.
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- *
- *
- */
- #include "HistoryLineEdit.h"
- HistoryLineEdit::HistoryLineEdit(QWidget *parent) : QLineEdit(parent) {}
- void HistoryLineEdit::keyPressEvent(QKeyEvent *event)
- {
- switch (event->key()) {
- case Qt::Key_Enter:
- case Qt::Key_Return:
- emit returnPressed();
- event->accept(); // This fixes an issue on Mac OS X which makes a weird noise
- //because LineEdit does not allow return as a valid input
- // Should be fixed in the next Release of QT ( > 4.6 )
- break;
- case Qt::Key_Up:
- emit upPressed(); // Scroll back in the input history
- event->accept();
- break;
- case Qt::Key_Down:
- emit downPressed(); // Scroll forward in the input history
- event->accept();
- break;
- case Qt::Key_Tab:
- emit tabPressed();
- event->accept();
- break;
- default:
- QLineEdit::keyPressEvent(event);
- break;
- }
- }
- bool HistoryLineEdit::focusNextPrevChild(bool)
- {
- return true; // Show that we have found the "nextprevchild" - we will keep focus!
- }
|