since I am a fan of subclassing, I made a small example with subclassing QLineEdit, but the same could be achieved with an event filter.
{
public:
{
}
protected:
{
event->accept();
// determine which key is pressed and what hebrew letter it should be. ("switch" over event->key())
Qt::Key_unknown,
Qt::NoModifier,
}
};
class HebrewInput : public QLineEdit
{
public:
HebrewInput(QWidget *parent = 0) : QLineEdit(parent)
{
setLocale(QLocale::Hebrew);
}
protected:
void keyPressEvent ( QKeyEvent * event )
{
event->accept();
// determine which key is pressed and what hebrew letter it should be. ("switch" over event->key())
QKeyEvent e(QEvent::KeyPress,
Qt::Key_unknown,
Qt::NoModifier,
QString::fromUtf8("ש"));
QLineEdit::keyPressEvent(&e);
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks