diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-02-20 18:41:31 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2021-02-20 18:42:25 +0900 |
commit | cf258cdbd6132a549d87abbd285e5aa663130d72 (patch) | |
tree | 9b8fc9fa9cb3c70ae1b5c65480fe5b6330c95ecc | |
parent | 543ee0948ccb0138453a99bff403c780b974a79f (diff) | |
download | kvkbd-cf258cdbd6132a549d87abbd285e5aa663130d72.tar.gz kvkbd-cf258cdbd6132a549d87abbd285e5aa663130d72.zip |
Simplified code for numpad buttons. This adds on to PR #9.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 47d89f2d15ad750689d6376234b37b85e1ab5704)
-rw-r--r-- | src/MainWidget.cpp | 10 | ||||
-rw-r--r-- | src/numpadvbutton.cpp | 9 | ||||
-rw-r--r-- | src/numpadvbutton.h | 11 |
3 files changed, 8 insertions, 22 deletions
diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp index 43d0516..e57ff39 100644 --- a/src/MainWidget.cpp +++ b/src/MainWidget.cpp @@ -20,6 +20,7 @@ #include "MainWidget.h" #include "VButton.h" +#include "numpadvbutton.h" #include <cstdlib> @@ -417,14 +418,13 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const "End", TQString::fromUtf8("▼"), "Pg\nDn" }; TQString nump[9] = {"7","8","9","4","5","6","1","2","3"}; int val=0; - int nval[9] = {79,80,81,83,84,85,87,88,89}; int cval[9] = {79,80,81,83,84,85,87,88,89}; for (int a=2;a<5;a++){ for (int b=0;b<3;b++){ NumpadVButton *v = new NumpadVButton(this,""); v->move(padx+(b*35),sty+(a*35)); v->res(); - v->setKeyCode(nval[val],cval[val]); + v->setKeyCode(cval[val]); v->setText(txt[val]); v->setShiftText(nump[val]); numl_keys.append(v); @@ -437,7 +437,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const ins->move(padx,sty+(5*35)); ins->res(); ins->setText("Ins"); - ins->setKeyCode(90,90); + ins->setKeyCode(90); ins->setShiftText("0"); numl_keys.append(ins); @@ -449,7 +449,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const del->res(); del->setText("Del"); del->setShiftText("."); - del->setKeyCode(91,91); + del->setKeyCode(91); numl_keys.append(del); connect ( del, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); @@ -485,7 +485,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const ent->resize(30,65); ent->move(padx+70+35,sty+(4*35)); ent->res(); - ent->setText("Ent"); + ent->setText("En\nter"); ent->setKeyCode(104); other_keys.append(ent); connect ( ent, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) ); diff --git a/src/numpadvbutton.cpp b/src/numpadvbutton.cpp index 3e64fb0..722d90f 100644 --- a/src/numpadvbutton.cpp +++ b/src/numpadvbutton.cpp @@ -34,19 +34,10 @@ void NumpadVButton::numlockPressed(bool press) { if (press==true){ TQPushButton::setText(u); - VButton::setKeyCode(numlock_code); } else{ TQPushButton::setText(l); - VButton::setKeyCode(cursor_code); } } -void NumpadVButton::setKeyCode(unsigned int numpad_keycode, unsigned int cursor_keycode) -{ - cursor_code = cursor_keycode; - numlock_code = numpad_keycode; - VButton::setKeyCode(cursor_code); -} - #include "numpadvbutton.moc" diff --git a/src/numpadvbutton.h b/src/numpadvbutton.h index 53bcddf..fc8a026 100644 --- a/src/numpadvbutton.h +++ b/src/numpadvbutton.h @@ -30,15 +30,10 @@ class NumpadVButton : public VButton Q_OBJECT public: - NumpadVButton(TQWidget *parent = 0, const char *name = 0); - ~NumpadVButton(); - void numlockPressed(bool press); - void setKeyCode(unsigned int keycode, unsigned int n_keycode); - -private: - unsigned int numlock_code; - unsigned int cursor_code; + NumpadVButton(TQWidget *parent = 0, const char *name = 0); + ~NumpadVButton(); + void numlockPressed(bool press); }; #endif |