From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- qtjava/javalib/tutorial/t9/LCDRange.java | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 qtjava/javalib/tutorial/t9/LCDRange.java (limited to 'qtjava/javalib/tutorial/t9/LCDRange.java') diff --git a/qtjava/javalib/tutorial/t9/LCDRange.java b/qtjava/javalib/tutorial/t9/LCDRange.java new file mode 100644 index 00000000..7bbb9886 --- /dev/null +++ b/qtjava/javalib/tutorial/t9/LCDRange.java @@ -0,0 +1,38 @@ +import org.kde.qt.*; + +public class LCDRange extends QVBox { + private QSlider slider; + + public LCDRange(QWidget parent, String name) { + super(parent, name); + QLCDNumber lcd = new QLCDNumber(2, this, "lcd"); + slider = new QSlider(Horizontal, this, "slider"); + slider.setRange(0, 99); + slider.setValue(0); + + connect(slider, SIGNAL("valueChanged(int)"), + lcd, SLOT("display(int)")); + connect(slider, SIGNAL("valueChanged(int)"), + SIGNAL("valueChanged(int)")); + + setFocusProxy(slider); + } + + public int value() { + return slider.value(); + } + + public void setValue(int value) { + slider.setValue(value); + } + + public void setRange(int minVal, int maxVal) { + if (minVal < 0 || maxVal > 99 || minVal > maxVal) { + qWarning("LCDRange::setRange("+minVal+","+maxVal+")\n"+ + "\tRange must be 0..99\n"+ + "\tand minVal must not be greater than maxVal"); + return; + } + slider.setRange(minVal, maxVal); + } +} -- cgit v1.2.1