2013-10-23 14:39 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/gtqtc/gtqtc1.cpp
    * added support for keyevents with multicharacter strings.
      QT documentation says that such feature is enabled by
      Qt::WA_KeyCompression attribute and I left comment about
      it in the QTConsole() constructor but practice showed that
      on some platforms it was enabled even without setting this
      attribute and users using keyboard barcode readers reported
      "eaten" characters.
    * explicitly enabled Qt::WA_KeyCompression and removed comment
      about missing functionality in QTC keyPressEvent() code.
This commit is contained in:
Przemysław Czerpak
2013-10-23 14:39:26 +02:00
parent 9215bd6600
commit 0d4b5972dc
2 changed files with 26 additions and 10 deletions

View File

@@ -10,6 +10,18 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-10-23 14:39 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/gtqtc/gtqtc1.cpp
* added support for keyevents with multicharacter strings.
QT documentation says that such feature is enabled by
Qt::WA_KeyCompression attribute and I left comment about
it in the QTConsole() constructor but practice showed that
on some platforms it was enabled even without setting this
attribute and users using keyboard barcode readers reported
"eaten" characters.
* explicitly enabled Qt::WA_KeyCompression and removed comment
about missing functionality in QTC keyPressEvent() code.
2013-10-23 12:41 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/gttrm/gttrm.c
* send ST (ESC \) after Linux console palette set sequence (ESC ] P).

View File

@@ -2439,6 +2439,7 @@ QTConsole::QTConsole( PHB_GTQTC pStructQTC, QWidget *parent ) : QWidget( parent
setAttribute( Qt::WA_StaticContents );
setAttribute( Qt::WA_PaintOnScreen );
setAttribute( Qt::WA_OpaquePaintEvent );
setAttribute( Qt::WA_KeyCompression );
/* Qt::WA_InputMethodEnabled disables support for
* national characters in few European countries
@@ -2448,11 +2449,6 @@ QTConsole::QTConsole( PHB_GTQTC pStructQTC, QWidget *parent ) : QWidget( parent
*/
/* setAttribute( Qt::WA_InputMethodEnabled ); */
/* It may be usable in some cases but KeyCompression
* needs some modifications in keyevent code [druzus]
*/
/* setAttribute( Qt::WA_KeyCompression ); */
setFocusPolicy( Qt::StrongFocus );
setMouseTracking( true );
@@ -3028,18 +3024,26 @@ void QTConsole::keyReleaseEvent( QKeyEvent * event )
void QTConsole::keyPressEvent( QKeyEvent * event )
{
int iKey = 0, iFlags = hb_gt_qtc_getKeyFlags( event->modifiers() );
int iKey = 0, iFlags = hb_gt_qtc_getKeyFlags( event->modifiers() ),
iSize, i;
/* support for national characters */
if( event->text().size() > 0 )
if( ( iSize = event->text().size() ) > 0 )
{
HB_WCHAR wc = event->text().constData()[ 0 ].unicode();
if( wc >= 32 && wc != 127 )
QString qStr = event->text();
HB_WCHAR wc = qStr[ 0 ].unicode();
if( iSize > 1 || ( wc >= 32 && wc != 127 ) )
{
if( ( iFlags & HB_KF_CTRL ) != 0 && ( iFlags & HB_KF_ALT ) != 0 )
/* workaround for AltGR and German keyboard */
iFlags &= ~( HB_KF_CTRL | HB_KF_ALT );
hb_gt_qtc_addKeyToInputQueue( pQTC, HB_INKEY_NEW_UNICODEF( wc, iFlags ) );
for( i = 0; i < iSize; ++i )
{
wc = qStr[ i ].unicode();
hb_gt_qtc_addKeyToInputQueue( pQTC, HB_INKEY_NEW_UNICODEF( wc, iFlags ) );
}
return;
}
}