Changeset 106
- Timestamp:
- Jul 29, 2006, 3:56:44 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/kernel/qapplication_pm.cpp ¶
r102 r106 1201 1201 1202 1202 case WM_CHAR: { // keyboard event 1203 //@@TODO (dmik): remove 1204 //qDebug("WM_CHAR: [%s]", widget->name()); 1203 #if 0 1204 qDebug( "WM_CHAR: [%s]", widget->name() ); 1205 #endif 1205 1206 QWidget *g = QWidget::keyboardGrabber(); 1206 1207 if ( g ) … … 1209 1210 widget = (QETWidget*)qApp->focusWidget(); 1210 1211 else if ( !widget ) 1211 // @@TODO (dmik):currently we don't use WinSetFocus(). what for? Qt seems1212 /// @todo (dmik) currently we don't use WinSetFocus(). what for? Qt seems 1212 1213 // to completely handle focus traversal itself. 1213 1214 // || widget->winId() == WinQueryFocus( HWND_DESKTOP ) ) // We faked the message to go to exactly that widget. 1214 1215 widget = (QETWidget*)widget->topLevelWidget(); 1215 1216 if ( widget->isEnabled() ) { 1216 // @@TODO (dmik):we should not pass WM_CHAR to the default window proc,1217 /// @todo (dmik) we should not pass WM_CHAR to the default window proc, 1217 1218 // otherwise it will come to us again through the widget parent (owner in PM) 1218 1219 // if the widget is not top-level, and will be treated by translateKeyEvent() … … 1228 1229 } 1229 1230 1230 // @@TODO (dmik):later1231 /// @todo (dmik) later 1231 1232 // case WM_APPCOMMAND: 1232 1233 // { … … 2663 2664 2664 2665 // when the compatibility mode is FALSE Qt/OS2 uses the following rule 2665 // to calculate QKeyEvent::key() codes when the thealpha-numeric key is2666 // to calculate QKeyEvent::key() codes when an alpha-numeric key is 2666 2667 // pressed: key code is the ASCII (Latin 1) character code of that key as if 2667 2668 // there were no any keyboard modifiers (CTRL, SHIFT, ALT) pressed, with the … … 2669 2670 // when the compatibility mode is TRUE Qt/OS2 behaves mostly like Qt/Win32. 2670 2671 Q_EXPORT bool qt_kbd_compatibility = TRUE; 2671 //@@TODO (dmik): currentlly, qt_kbd_compatibility is TRUE because 2672 2673 /// @todo (dmik) currentlly, qt_kbd_compatibility is TRUE because 2672 2674 // qt_scan2Ascii function below is not well implemented yet (in particular, 2673 // it uses the 850 code page that can be not available on some systems...) 2675 // it uses the 850 code page that may not be available on some systems...). 2676 // Once we find a way to translate scans to US ASCII regardless of the current 2677 // code page and/or NLS state (keyboard layout), qt_kbd_compatibility may be 2678 // set to FALSE. This, in particular, will enable more correct handling of 2679 // Alt+letter combinations when the keyboard is in the NLS state: 2680 // QKeyEvent::key() will return a non-null Qt::Key_XXX code corresponding to 2681 // the ASCII code of a pressed key, which in turn will let Qt process latin 2682 // Alt+letter shortcuts in the NLS keyboard mode together with Alt+NLS_letter 2683 // shortcuts (nice feature imho). Note that Alt+NLS_letter shortcuts are 2684 // correctly processed in any case. 2674 2685 2675 2686 // cache table to store Qt::Key_... values for 256 hardware scancodes … … 2713 2724 2714 2725 // translates WM_CHAR to Qt::Key_..., ascii, state and text 2715 void translateKeyCode( 2716 CHRMSG &chm, int &code, int &ascii, int &state, QString &text2717 ){2726 static void translateKeyCode( CHRMSG &chm, int &code, int &ascii, int &state, 2727 QString &text ) 2728 { 2718 2729 if ( chm.fs & KC_SHIFT ) 2719 2730 state |= Qt::ShiftButton; … … 2793 2804 break; 2794 2805 default: 2806 // break if qt_kbd_compatibility = TRUE to avoid using 2807 // qt_scan2Ascii(), see comments to qt_kbd_compatibility 2795 2808 if ( qt_kbd_compatibility ) break; 2796 2809 // deduce Qt::Key... from scancode … … 2874 2887 if ( ascii > 0x7F ) ascii = 0; 2875 2888 if ( ch ) 2876 //@@TODO (dmik): later: optimize by using UniUconvToUcs directly2877 2889 text = QString::fromLocal8Bit( (char*)&ch, 1 ); 2878 2890 } 2879 2880 //@@TODO (dmik): do we need to export this also? I don't see that it is used2881 // anywhere in Qt/Win32...2882 //Q_EXPORT int qt_translateKeyCode(int key)2883 //{2884 // return translateKeyCode(key);2885 //}2886 2891 2887 2892 struct KeyRec { … … 2944 2949 } 2945 2950 2946 static void store_key_rec( 2947 unsigned char scan, int code, int ascii, const QString& text2948 ){2951 static void store_key_rec( unsigned char scan, int code, int ascii, 2952 const QString& text ) 2953 { 2949 2954 if ( nrecs == maxrecs ) { 2950 2955 #if defined(QT_CHECK_RANGE) … … 2997 3002 // remove the Key_Alt from the buffer (otherwise we will 2998 3003 // not get the next "Alt pressed" event because the 2999 // "Alt depressed" event, that must preceed it, w ell be3004 // "Alt depressed" event, that must preceed it, will be 3000 3005 // eaten by the system) 3001 //@@TODO (dmik): do the same for other global keys (ALT+TAB, ALT+ESC, CTRL+ESC) 3006 find_key_rec( Qt::Key_Alt, TRUE ); 3007 /// @todo (dmik) do the same for other global keys (ALT+TAB, ALT+ESC, CTRL+ESC) 3002 3008 // by handling this situation when we obtain/loose focus) 3003 find_key_rec( Qt::Key_Alt, TRUE ); 3009 /// @todo (dmik) update: I don't actually think the above should be done, because 3010 // it will not solve the problem of stuck modifier keys in general (there may be 3011 // other combinations stolen by the system or other apps). More over, I guess 3012 // that find_key_rec() above should also be removed to get identical behavior for 3013 // all stolen keys. This will allow to solve the problem on the Qt application 3014 // level if needed (and even in a platform-independent manner). 3004 3015 } 3005 3016 return TRUE; … … 3020 3031 if ( rec->code < Key_Shift || rec->code > Key_ScrollLock ) { 3021 3032 k0 = sendKeyEvent( QEvent::KeyRelease, rec->code, rec->ascii, 3022 state, grab, rec->text, TRUE );3033 state, grab, rec->text, TRUE ); 3023 3034 k1 = sendKeyEvent( QEvent::KeyPress, rec->code, rec->ascii, 3024 state, grab, rec->text, TRUE );3035 state, grab, rec->text, TRUE ); 3025 3036 } 3026 3037 } else { … … 3040 3051 } else { 3041 3052 k0 = sendKeyEvent( QEvent::KeyRelease, rec->code, rec->ascii, 3042 state, grab, rec->text );3053 state, grab, rec->text ); 3043 3054 3044 3055 // keyboard context menu event … … 3048 3059 } 3049 3060 3050 //@@TODO (dmik): remove 3051 // qDebug("WM_CHAR: RESULT = %d", (k0 || k1)); 3061 #if 0 3062 qDebug("WM_CHAR: RESULT = %d", (k0 || k1)); 3063 #endif 3052 3064 return k0 || k1; 3053 3065 } -
TabularUnified trunk/src/widgets/qtextedit.cpp ¶
r8 r106 1376 1376 if ( e->text().length() && 1377 1377 ( !( e->state() & ControlButton ) && 1378 #ifndef Q_OS_MACX 1378 #if !defined(Q_OS_MACX) && !defined(Q_OS_OS2) 1379 // AltGr+key can produce valid characters in some kbd layouts 1380 // (i.e. the German one) which we must not ignore 1379 1381 !( e->state() & AltButton ) && 1380 1382 #endif 1381 1383 !( e->state() & MetaButton ) || 1384 // Note (dmik): the below line is possibly a typo because it's 1385 // equivalent to just (e->state() & ControlButton) which obviously 1386 // contradicts !( e->state() & ControlButton ) above. Anyway, 1387 // as a result, Ctrl+key are successfully handled by QTextEdit on 1388 // all platforms (because of the || operator), unless assigned 1389 // as hot keys (shortcuts). 1382 1390 ( ( (e->state()&ControlButton) | AltButton ) == (ControlButton|AltButton) ) ) && 1383 1391 ( !e->ascii() || e->ascii() >= 32 || e->text() == "\t" ) ) {
Note:
See TracChangeset
for help on using the changeset viewer.