-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index d0850e3..ec1b30c 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp @@ -245,5 +245,15 @@ void TEWidget::fontChange(const QFont &) QFontMetrics fm(font()); font_h = fm.height(); - font_w = fm.maxWidth(); + + // font_w = max width of ASCII chars (U.B.) + font_w = 0; + int fw; + for (int i = 0x20; i < 0x80; i++) { + if (isprint(i) && font_w < (fw = fm.width(i))) { + font_w = fw; + } + } + //font_w = fm.maxWidth(); + font_a = fm.ascent(); //printf("font_h: %d\n",font_h); @@ -1021,4 +1031,5 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); bool dele=FALSE; + if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { QKeyEvent* ke = (QKeyEvent*)e; @@ -1059,4 +1070,8 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); + if(ke->key() == Key_Escape) { + qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); + + } if( ke->state() == ShiftButton && ke->key() == Key_Tab) { |