summaryrefslogtreecommitdiffstats
path: root/src/VButton.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-03-15 10:50:14 +0900
committerMichele Calgaro <[email protected]>2021-03-15 11:20:18 +0900
commit37c26178be0e54dc42908b1cc5d7ec4802aff85b (patch)
tree2dedbcc64a1110bd2bc08fabb45a9d5e4ee5cfe3 /src/VButton.cpp
parent670268c0714ce4754cac757a4b13cc0fcdb71bd6 (diff)
downloadkvkbd-37c26178be0e54dc42908b1cc5d7ec4802aff85b.tar.gz
kvkbd-37c26178be0e54dc42908b1cc5d7ec4802aff85b.zip
Fixed behavior of caps for non-alpha characters, which was broken in
commit 1865767. Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit 48c1053fa1e5896a10e576b9eb35634fa789cff4)
Diffstat (limited to 'src/VButton.cpp')
-rw-r--r--src/VButton.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/VButton.cpp b/src/VButton.cpp
index cabedd1..c949612 100644
--- a/src/VButton.cpp
+++ b/src/VButton.cpp
@@ -21,27 +21,44 @@ VButton::~VButton()
{
}
-void VButton::shiftPressed(bool press)
+void VButton::shiftCapsPressed(bool shift, bool caps)
{
- if (press)
+ if (isAlpha)
{
- TQPushButton::setText(u);
+ // Alpha button, both shift and caps affect its state
+ if (shift ^ caps)
+ {
+ TQPushButton::setText(shiftText);
+ }
+ else
+ {
+ TQPushButton::setText(lowerText);
+ }
}
else
{
- TQPushButton::setText(l);
+ // Non alpha button, only shift affects its state
+ if (shift)
+ {
+ TQPushButton::setText(shiftText);
+ }
+ else
+ {
+ TQPushButton::setText(lowerText);
+ }
}
}
void VButton::setText(const TQString& text)
{
TQPushButton::setText(text);
- l=text;
+ lowerText = text;
+ isAlpha = text.length() == 1 && (text.upper() != text);
}
void VButton::setShiftText(const TQString& text)
{
- u=text;
+ shiftText=text;
}
void VButton::setColor(const TQColor &color)