author | llornkcor <llornkcor> | 2004-01-17 22:19:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-01-17 22:19:17 (UTC) |
commit | e9700698b2d664a688af20008095551624c995ae (patch) (unidiff) | |
tree | 0beaf08275a67e674c7cdd06df5c8431f538d59a /core/apps | |
parent | 839775ea257f2c9be752a77c41a09416469df591 (diff) | |
download | opie-e9700698b2d664a688af20008095551624c995ae.zip opie-e9700698b2d664a688af20008095551624c995ae.tar.gz opie-e9700698b2d664a688af20008095551624c995ae.tar.bz2 |
fix for ascii char width
-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 | |||
@@ -244,7 +244,17 @@ void TEWidget::fontChange(const QFont &) | |||
244 | { | 244 | { |
245 | QFontMetrics fm(font()); | 245 | QFontMetrics fm(font()); |
246 | font_h = fm.height(); | 246 | font_h = fm.height(); |
247 | font_w = fm.maxWidth(); | 247 | |
248 | // font_w = max width of ASCII chars (U.B.) | ||
249 | font_w = 0; | ||
250 | int fw; | ||
251 | for (int i = 0x20; i < 0x80; i++) { | ||
252 | if (isprint(i) && font_w < (fw = fm.width(i))) { | ||
253 | font_w = fw; | ||
254 | } | ||
255 | } | ||
256 | //font_w = fm.maxWidth(); | ||
257 | |||
248 | font_a = fm.ascent(); | 258 | font_a = fm.ascent(); |
249 | //printf("font_h: %d\n",font_h); | 259 | //printf("font_h: %d\n",font_h); |
250 | //printf("font_w: %d\n",font_w); | 260 | //printf("font_w: %d\n",font_w); |
@@ -1020,6 +1030,7 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1020 | static bool alt = FALSE; | 1030 | static bool alt = FALSE; |
1021 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 1031 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); |
1022 | bool dele=FALSE; | 1032 | bool dele=FALSE; |
1033 | |||
1023 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1034 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1024 | QKeyEvent* ke = (QKeyEvent*)e; | 1035 | QKeyEvent* ke = (QKeyEvent*)e; |
1025 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 1036 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
@@ -1058,6 +1069,10 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1058 | // know where the current selection is. | 1069 | // know where the current selection is. |
1059 | 1070 | ||
1060 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); | 1071 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); |
1072 | if(ke->key() == Key_Escape) { | ||
1073 | qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); | ||
1074 | |||
1075 | } | ||
1061 | 1076 | ||
1062 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { | 1077 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { |
1063 | //lets hardcode this sucker | 1078 | //lets hardcode this sucker |