[Libreoffice-commits] core.git: 2 commits - vcl/qt5

2022-08-04 Thread Michael Weghorn (via logerrit)
 vcl/qt5/QtAccessibleWidget.cxx |   87 -
 1 file changed, 87 deletions(-)

New commits:
commit dcefd68f6df333949dab5958ab874db539b191bb
Author: Michael Weghorn 
AuthorDate: Thu Aug 4 09:21:02 2022 +0200
Commit: Michael Weghorn 
CommitDate: Thu Aug 4 13:12:27 2022 +0200

qt a11y: Drop extra empty lines in switch/case

Change-Id: I9208dccf15da918f8a30f21efb49986c69b68c5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137783
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index 970a87cccddf..0599b595f7fe 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -344,252 +344,170 @@ QAccessible::Role QtAccessibleWidget::role() const
 {
 case AccessibleRole::UNKNOWN:
 return QAccessible::NoRole;
-
 case AccessibleRole::ALERT:
 return QAccessible::AlertMessage;
-
 case AccessibleRole::COLUMN_HEADER:
 return QAccessible::ColumnHeader;
-
 case AccessibleRole::CANVAS:
 return QAccessible::Canvas;
-
 case AccessibleRole::CHECK_BOX:
 return QAccessible::CheckBox;
-
 case AccessibleRole::CHECK_MENU_ITEM:
 return QAccessible::MenuItem;
-
 case AccessibleRole::COLOR_CHOOSER:
 return QAccessible::ColorChooser;
-
 case AccessibleRole::COMBO_BOX:
 return QAccessible::ComboBox;
-
 case AccessibleRole::DATE_EDITOR:
 return QAccessible::EditableText;
-
 case AccessibleRole::DESKTOP_ICON:
 return QAccessible::Graphic;
-
 case AccessibleRole::DESKTOP_PANE:
 case AccessibleRole::DIRECTORY_PANE:
 return QAccessible::Pane;
-
 case AccessibleRole::DIALOG:
 return QAccessible::Dialog;
-
 case AccessibleRole::DOCUMENT:
 return QAccessible::Document;
-
 case AccessibleRole::EMBEDDED_OBJECT:
 return QAccessible::UserRole;
-
 case AccessibleRole::END_NOTE:
 return QAccessible::Note;
-
 case AccessibleRole::FILLER:
 return QAccessible::Whitespace;
-
 case AccessibleRole::FONT_CHOOSER:
 return QAccessible::UserRole;
-
 case AccessibleRole::FOOTER:
 return QAccessible::Footer;
-
 case AccessibleRole::FOOTNOTE:
 return QAccessible::Note;
-
 case AccessibleRole::FRAME: // top-level window with title bar
 return QAccessible::Window;
-
 case AccessibleRole::GLASS_PANE:
 return QAccessible::UserRole;
-
 case AccessibleRole::GRAPHIC:
 return QAccessible::Graphic;
-
 case AccessibleRole::GROUP_BOX:
 return QAccessible::Grouping;
-
 case AccessibleRole::HEADER:
 return QAccessible::UserRole;
-
 case AccessibleRole::HEADING:
 return QAccessible::Heading;
-
 case AccessibleRole::HYPER_LINK:
 return QAccessible::Link;
-
 case AccessibleRole::ICON:
 return QAccessible::Graphic;
-
 case AccessibleRole::INTERNAL_FRAME:
 return QAccessible::UserRole;
-
 case AccessibleRole::LABEL:
 return QAccessible::StaticText;
-
 case AccessibleRole::LAYERED_PANE:
 return QAccessible::Pane;
-
 case AccessibleRole::LIST:
 return QAccessible::List;
-
 case AccessibleRole::LIST_ITEM:
 return QAccessible::ListItem;
-
 case AccessibleRole::MENU:
 case AccessibleRole::MENU_BAR:
 return QAccessible::MenuBar;
-
 case AccessibleRole::MENU_ITEM:
 return QAccessible::MenuItem;
-
 case AccessibleRole::OPTION_PANE:
 return QAccessible::Pane;
-
 case AccessibleRole::PAGE_TAB:
 return QAccessible::PageTab;
-
 case AccessibleRole::PAGE_TAB_LIST:
 return QAccessible::PageTabList;
-
 case AccessibleRole::PANEL:
 return QAccessible::Pane;
-
 case AccessibleRole::PARAGRAPH:
 return QAccessible::Paragraph;
-
 case AccessibleRole::PASSWORD_TEXT:
 return QAccessible::EditableText;
-
 case AccessibleRole::POPUP_MENU:
 return QAccessible::PopupMenu;
-
 case AccessibleRole::PUSH_BUTTON:
 return QAccessible::Button;
-
 case AccessibleRole::PROGRESS_BAR:
 return QAccessible::ProgressBar;
-
 case AccessibleRole::RADIO_BUTTON:
 return QAccessible::RadioButton;
-
 case AccessibleRole::RADIO_MENU_ITEM:
 return QAccessible::MenuItem;
-
 case AccessibleRole::ROW_HEADER:
 return QAccessible::RowHeader;
-
 case AccessibleRole::ROOT_PANE:
 return QAccessible::Pane;
-
 case 

[Libreoffice-commits] core.git: 2 commits - vcl/qt5 vcl/source

2022-06-01 Thread Caolán McNamara (via logerrit)
 vcl/qt5/QtFontFace.cxx|   27 ++-
 vcl/qt5/QtGraphics_Text.cxx   |8 +++-
 vcl/source/filter/itiff/itiff.cxx |   13 -
 3 files changed, 41 insertions(+), 7 deletions(-)

New commits:
commit c90db9e43db509bef6892c8443480ffa9ed8bbe0
Author: Caolán McNamara 
AuthorDate: Wed Jun 1 12:40:23 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 1 16:03:32 2022 +0200

Resolves: tdf#149417 allow one short read in tiff import as not a failure

Change-Id: I77bff41abd51cfd3050836fff04e9644b0828c09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135239
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index 9c0b6efff6b6..672ef92d902a 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -37,9 +37,11 @@ namespace
 {
 SvStream& rStream;
 tsize_t nSize;
+int nShortReads;
 Context(SvStream& rInStream, tsize_t nInSize)
 : rStream(rInStream)
 , nSize(nInSize)
+, nShortReads(0)
 {
 }
 };
@@ -48,7 +50,16 @@ namespace
 static tsize_t tiff_read(thandle_t handle, tdata_t buf, tsize_t size)
 {
 Context* pContext = static_cast(handle);
-return pContext->rStream.ReadBytes(buf, size);
+tsize_t nRead = pContext->rStream.ReadBytes(buf, size);
+// tdf#149417 allow one short read, which is similar to what
+// we do for jpeg since tdf#138950
+if (nRead < size && !pContext->nShortReads)
+{
+memset(static_cast(buf) + nRead, 0, size - nRead);
+++pContext->nShortReads;
+return size;
+}
+return nRead;
 }
 
 static tsize_t tiff_write(thandle_t, tdata_t, tsize_t)
commit 3483df997170378dc44d4f025b960e489e0c7924
Author: Stephan Bergmann 
AuthorDate: Wed Jun 1 10:11:24 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jun 1 16:03:18 2022 +0200

Avoid -Werror,-Wdeprecated-declarations when building Library_vclplug_qt6

> vcl/qt6/../qt5/QtFontFace.cxx:132:19: error: 'QFontDatabase' is 
deprecated: Call the static functions instead 
[-Werror,-Wdeprecated-declarations]
> QFontDatabase aFDB;
>   ^
> /usr/include/qt6/QtGui/qfontdatabase.h:113:5: note: 'QFontDatabase' has 
been explicitly marked deprecated here
> QT_DEPRECATED_VERSION_X_6_0("Call the static functions instead") 
explicit QFontDatabase() = default;
> ^
> /usr/include/qt6/QtCore/qglobal.h:382:44: note: expanded from macro 
'QT_DEPRECATED_VERSION_X_6_0'
> # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
>^
> /usr/include/qt6/QtCore/qglobal.h:294:33: note: expanded from macro 
'QT_DEPRECATED_X'
> #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
> ^
> /usr/include/qt6/QtCore/qcompilerdetection.h:1146:36: note: expanded from 
macro 'Q_DECL_DEPRECATED_X'
> #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
>^

etc.

Change-Id: Icc6a5f2f78af9b287b71bdd347f396928a100b25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135225
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/qt5/QtFontFace.cxx b/vcl/qt5/QtFontFace.cxx
index 89182d115756..291d7e90fdef 100644
--- a/vcl/qt5/QtFontFace.cxx
+++ b/vcl/qt5/QtFontFace.cxx
@@ -129,19 +129,30 @@ QtFontFace* QtFontFace::fromQFont(const QFont& rFont)
 
 QtFontFace* QtFontFace::fromQFontDatabase(const QString& aFamily, const 
QString& aStyle)
 {
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+auto const isFixedPitch = QFontDatabase::isFixedPitch(aFamily, aStyle);
+auto const weigh = QFontDatabase::weight(aFamily, aStyle);
+auto const italic = QFontDatabase::italic(aFamily, aStyle);
+auto const aPointList = QFontDatabase::pointSizes(aFamily, aStyle);
+#else
 QFontDatabase aFDB;
+auto const isFixedPitch = aFDB.isFixedPitch(aFamily, aStyle);
+auto const weigh = aFDB.weight(aFamily, aStyle);
+auto const italic = aFDB.italic(aFamily, aStyle);
+auto const aPointList = aFDB.pointSizes(aFamily, aStyle);
+#endif
+
 FontAttributes aFA;
 
 aFA.SetFamilyName(toOUString(aFamily));
 if (IsStarSymbol(aFA.GetFamilyName()))
 aFA.SetSymbolFlag(true);
 aFA.SetStyleName(toOUString(aStyle));
-aFA.SetPitch(aFDB.isFixedPitch(aFamily, aStyle) ? PITCH_FIXED : 
PITCH_VARIABLE);
-aFA.SetWeight(QtFontFace::toFontWeight(aFDB.weight(aFamily, aStyle)));
-aFA.SetItalic(aFDB.italic(aFamily, aStyle) ? ITALIC_NORMAL : ITALIC_NONE);
+aFA.SetPitch(isFixedPitch ? PITCH_FIXED : PITCH_VARIABLE);
+aFA.SetWeight(QtFontFace::toFontWeight(weigh));
+aFA.SetItalic(italic ? ITALIC_NORMAL : ITALIC_NONE);
 
 int nPointSize = 0;
-

[Libreoffice-commits] core.git: 2 commits - vcl/qt5

2021-07-20 Thread Michael Weghorn (via logerrit)
 vcl/qt5/Qt5AccessibleWidget.cxx |   22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 6c88244908409e1d5a4ffe5fffbad35f9892b9fa
Author: Michael Weghorn 
AuthorDate: Tue Jul 20 12:47:38 2021 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jul 21 04:08:10 2021 +0200

qt5 a11y: Skip attributes without value

Skip attributes with empty string value in
'Qt5AccessibleWidget::attributes'.

Besides not being a useful value, I also
got a crash using Accerciser to navigate in Calc's
"Format Cells" dialog -> "Font Effects" -> "Text Decoration"
-> "Overlining" -> "Overlining".

'Qt5AccessibleWidget::attributes' had returned
"font-family:;font-size:0pt;font-weight:normal;"
and 'AtSpiAdaptor::getAttributes' (from the Qt library)
aborts, since it splits the "font-family:" part at the colon,
then expects two substrings: one for the attribute name, one
for the value - but there was no value set:

QString joined = interface->textInterface()->attributes(offset, 
, );
const QStringList attributes = joined.split (QLatin1Char(';'), 
Qt::SkipEmptyParts, Qt::CaseSensitive);
for (const QString  : attributes) {
QStringList items;
items = attr.split(QLatin1Char(':'), Qt::SkipEmptyParts, 
Qt::CaseSensitive);
->  AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]);
if (!attribute.isNull())
set[attribute.name] = attribute.value;
}

The IAccessible2 spec for the "background-color" text attribute [1]
doesn't specify any default value to be used.

Backtrace:

Thread 1 received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:50
50  ../sysdeps/unix/sysv/linux/raise.c: No such file or 
directory.
(rr) bt
#0  __GI_raise (sig=sig@entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:50
#1  0x7f4dcd0bd537 in __GI_abort () at abort.c:79
#2  0x7f4dba7fd810 in qt_message_fatal(QtMsgType, 
QMessageLogContext const&, QString const&) (context=..., message=...) at 
global/qlogging.cpp:1914
#3  0x7f4dba7f9d48 in QMessageLogger::fatal(char const*, ...) const 
(this=0x7ffc30a4a6b0, msg=0x7f4dbab9ebb0 "ASSERT failure in %s: \"%s\", file 
%s, line %d") at global/qlogging.cpp:893
#4  0x7f4dba7f1484 in qt_assert_x(char const*, char const*, char 
const*, int) (where=0x7f4db778eb36 "QList::operator[]", what=0x7f4db778eac8 
"index out of range", file=0x7f4db778ea90 
"../../../include/QtCore/../../src/corelib/tools/qlist.h", line=579)
at global/qglobal.cpp:3366
#5  0x7f4db7736a65 in QList::operator[](int) 
(this=0x7ffc30a4a730, i=1) at 
../../../include/QtCore/../../src/corelib/tools/qlist.h:579
#6  0x7f4db773017e in 
AtSpiAdaptor::getAttributes(QAccessibleInterface*, int, bool) const 
(this=0x557748f27800, interface=0x7f4d8c07cc30, offset=9, includeDefaults=true) 
at atspiadaptor.cpp:2059
#7  0x7f4db772cd74 in 
AtSpiAdaptor::textInterface(QAccessibleInterface*, QString const&, QDBusMessage 
const&, QDBusConnection const&) (this=0x557748f27800, interface=0x7f4d8c07cc30, 
function=..., message=..., connection=...) at atspiadaptor.cpp:1802
#8  0x7f4db77274f8 in AtSpiAdaptor::handleMessage(QDBusMessage 
const&, QDBusConnection const&) (this=0x557748f27800, message=..., 
connection=...) at atspiadaptor.cpp:1286
#9  0x7f4db7fe4d04 in 
QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, 
QDBusMessage const&, int) (this=0x7f4d8c014b00, node=..., msg=..., 
pathStartPos=27) at qdbusintegrator.cpp:1458
#10 0x7f4db7fe58ca in 
QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x557753615310) at 
qdbusintegrator.cpp:1617
#11 0x7f4dbaab3c66 in QObject::event(QEvent*) (this=0x557748f27800, 
e=0x557753615310) at kernel/qobject.cpp:1314
#12 0x7f4db96be845 in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) (this=0x557747e30970, receiver=0x557748f27800, e=0x557753615310) at 
kernel/qapplication.cpp:3632
#13 0x7f4db96bbcfb in QApplication::notify(QObject*, QEvent*) 
(this=0x557747f1d8b0, receiver=0x557748f27800, e=0x557753615310) at 
kernel/qapplication.cpp:2972
#14 0x7f4dbaa70aba in QCoreApplication::notifyInternal2(QObject*, 
QEvent*) (receiver=0x557748f27800, event=0x557753615310) at 
kernel/qcoreapplication.cpp:1064
#15 0x7f4dbaa71452 in QCoreApplication::sendEvent(QObject*, 
QEvent*) (receiver=0x557748f27800, event=0x557753615310) at 
kernel/qcoreapplication.cpp:1462
#16 0x7f4dbaa7213a in 
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) 
(receiver=0x0, event_type=0, data=0x557747eff460) at 
kernel/qcoreapplication.cpp:1821
#17 0x7f4dbaa71acc in 

[Libreoffice-commits] core.git: 2 commits - vcl/qt5 vcl/win

2021-02-24 Thread Caolán McNamara (via logerrit)
 vcl/qt5/Qt5Frame.cxx|1 -
 vcl/win/window/salframe.cxx |   11 ---
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit c5fd81769e7c683a8e4c73caaf85954f0df48de4
Author: Caolán McNamara 
AuthorDate: Tue Feb 23 20:04:22 2021 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 24 10:08:15 2021 +0100

don't need to include vcl/layout.hxx in qt5

Change-Id: I8e08c4e5c5b92df4cbdb8ea32f40dbde25f7afd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111433
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 6ea28517dbd8..f8f8d20dae6f 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -59,7 +59,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 #include 
commit b258aec6cff0036397ee4115e08f677ba77797a0
Author: Noel Grandin 
AuthorDate: Wed Feb 24 09:53:53 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Feb 24 10:07:55 2021 +0100

use unique_ptr in ImplHandleIMECompositionInput

Change-Id: I9587d97fbdd73844590fd6380e594ec7b4f4df14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111441
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 3454ebf885c8..0d211d3bf3f2 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5045,7 +5045,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* 
pFrame,
 {
 bDef = false;
 
-ExtTextInputAttr* pSalAttrAry = nullptr;
+std::unique_ptr pSalAttrAry;
 LONGnTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 
nullptr, 0 ) / sizeof( WCHAR );
 if ( nTextLen > 0 )
 {
@@ -5066,8 +5066,8 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* 
pFrame,
 if ( pAttrBuf )
 {
 sal_Int32 nTextLen2 = aEvt.maText.getLength();
-pSalAttrAry = new ExtTextInputAttr[nTextLen2];
-memset( pSalAttrAry, 0, nTextLen2*sizeof( sal_uInt16 ) );
+pSalAttrAry.reset(new ExtTextInputAttr[nTextLen2]);
+memset( pSalAttrAry.get(), 0, nTextLen2*sizeof( sal_uInt16 ) );
 for( sal_Int32 i = 0; (i < nTextLen2) && (i < nAttrLen); i++ )
 {
 BYTE nWinAttr = pAttrBuf.get()[i];
@@ -5088,7 +5088,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* 
pFrame,
 pSalAttrAry[i] = nSalAttr;
 }
 
-aEvt.mpTextAttr = pSalAttrAry;
+aEvt.mpTextAttr = pSalAttrAry.get();
 }
 }
 
@@ -5123,9 +5123,6 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* 
pFrame,
 }
 ImplUpdateIMECursorPos( pFrame, hIMC );
 }
-
-if ( pSalAttrAry )
-delete [] pSalAttrAry;
 }
 
 return !bDef;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/qt5

2017-11-07 Thread Jan-Marek Glogowski
 vcl/qt5/Qt5Data.cxx   |2 
 vcl/qt5/Qt5Widget.cxx |  113 --
 vcl/qt5/Qt5Widget.hxx |   25 +++
 3 files changed, 127 insertions(+), 13 deletions(-)

New commits:
commit 9858edd6576b03292bccfebb142fc92588df0c42
Author: Jan-Marek Glogowski 
Date:   Tue Nov 7 13:18:05 2017 +0100

QT5 initial keyboard support

No idea, if we can / should map those vendor specific keys, like
Gtk+ does.

This also prefixes the non-virtual functions with "handle".

Change-Id: Id8c42651e07d33728ff6deced06a82de29aa3fad

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index e17cd7da1a10..8d55aaa6832b 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -24,7 +24,9 @@
 #include "Qt5Graphics.hxx"
 #include "Qt5Tools.hxx"
 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,6 +42,7 @@ Qt5Widget::Qt5Widget( Qt5Frame , QWidget *parent, 
Qt::WindowFlags f )
 {
 create();
 setMouseTracking( true );
+setFocusPolicy( Qt::StrongFocus );
 }
 
 Qt5Widget::~Qt5Widget()
@@ -85,7 +88,7 @@ void Qt5Widget::resizeEvent( QResizeEvent* )
 m_pFrame->CallCallback( SalEvent::Resize, nullptr );
 }
 
-void Qt5Widget::mouseButtonEvent( QMouseEvent *pEvent, bool bReleased )
+void Qt5Widget::handleMouseButtonEvent( QMouseEvent *pEvent, bool bReleased )
 {
 SalMouseEvent aEvent;
 switch( pEvent->button() )
@@ -112,12 +115,12 @@ void Qt5Widget::mouseButtonEvent( QMouseEvent *pEvent, 
bool bReleased )
 
 void Qt5Widget::mousePressEvent( QMouseEvent *pEvent )
 {
-mouseButtonEvent( pEvent, false );
+handleMouseButtonEvent( pEvent, false );
 }
 
 void Qt5Widget::mouseReleaseEvent( QMouseEvent *pEvent )
 {
-mouseButtonEvent( pEvent, true );
+handleMouseButtonEvent( pEvent, true );
 }
 
 void Qt5Widget::mouseMoveEvent( QMouseEvent *pEvent )
@@ -175,4 +178,101 @@ void Qt5Widget::showEvent( QShowEvent* )
 m_pFrame->CallCallback( SalEvent::Paint,  );
 }
 
+static sal_uInt16 GetKeyCode( int keyval )
+{
+sal_uInt16 nCode = 0;
+if( keyval >= Qt::Key_0 && keyval <= Qt::Key_9 )
+nCode = KEY_0 + ( keyval - Qt::Key_0 );
+else if( keyval >= Qt::Key_A && keyval <= Qt::Key_Z )
+nCode = KEY_A + ( keyval - Qt::Key_A );
+else if( keyval >= Qt::Key_F1 && keyval <= Qt::Key_F26 )
+nCode = KEY_F1 + (keyval - Qt::Key_F1);
+else
+{
+switch( keyval )
+{
+case Qt::Key_Down:  nCode = KEY_DOWN; break;
+case Qt::Key_Up:nCode = KEY_UP;   break;
+case Qt::Key_Left:  nCode = KEY_LEFT; break;
+case Qt::Key_Right: nCode = KEY_RIGHT;break;
+case Qt::Key_Home:  nCode = KEY_HOME; break;
+case Qt::Key_End:   nCode = KEY_END;  break;
+case Qt::Key_PageUp:nCode = KEY_PAGEUP;   break;
+case Qt::Key_PageDown:  nCode = KEY_PAGEDOWN; break;
+case Qt::Key_Return:nCode = KEY_RETURN;   break;
+case Qt::Key_Escape:nCode = KEY_ESCAPE;   break;
+case Qt::Key_Tab:   nCode = KEY_TAB;  break;
+case Qt::Key_Backspace: nCode = KEY_BACKSPACE;break;
+case Qt::Key_Space: nCode = KEY_SPACE;break;
+case Qt::Key_Insert:nCode = KEY_INSERT;   break;
+case Qt::Key_Delete:nCode = KEY_DELETE;   break;
+case Qt::Key_Plus:  nCode = KEY_ADD;  break;
+case Qt::Key_Minus: nCode = KEY_SUBTRACT; break;
+case Qt::Key_Asterisk:  nCode = KEY_MULTIPLY; break;
+case Qt::Key_Slash: nCode = KEY_DIVIDE;   break;
+case Qt::Key_Period:nCode = KEY_POINT;break;
+case Qt::Key_Comma: nCode = KEY_COMMA;break;
+case Qt::Key_Less:  nCode = KEY_LESS; break;
+case Qt::Key_Greater:   nCode = KEY_GREATER;  break;
+case Qt::Key_Equal: nCode = KEY_EQUAL;break;
+case Qt::Key_Find:  nCode = KEY_FIND; break;
+case Qt::Key_Menu:  nCode = KEY_CONTEXTMENU;  break;
+case Qt::Key_Help:  nCode = KEY_HELP; break;
+case Qt::Key_Undo:  nCode = KEY_UNDO; break;
+case Qt::Key_Redo:  nCode = KEY_REPEAT;   break;
+case Qt::Key_Cancel:nCode = KEY_F11;  break;
+case Qt::Key_AsciiTilde:nCode = KEY_TILDE;break;
+case Qt::Key_QuoteLeft: nCode = KEY_QUOTELEFT;break;
+case Qt::Key_BracketLeft:   nCode = KEY_BRACKETLEFT;  break;
+case Qt::Key_BracketRight:  nCode = KEY_BRACKETRIGHT; break;
+