14 #if QT_VERSION < 0x040000
15 #include <qabstractlayout.h>
18 #include <QtGui/QHBoxLayout>
19 #include <QtGui/QVBoxLayout>
24 #include <qpushbutton.h>
28 #include <qcheckbox.h>
29 #include <qnamespace.h>
30 #include <qscrollbar.h>
31 #include <qlineedit.h>
32 #include <qmessagebox.h>
33 #include <qsizepolicy.h>
39 using namespace hippodraw;
45 :
QWidget ( parent, name, wflags )
58 policy.
setHorData ( QSizePolicy::MinimumExpanding );
60 #if QT_VERSION < 0x040000
62 lowSlider ->setFocusPolicy ( WheelFocus );
65 lowSlider ->setFocusPolicy ( Qt::WheelFocus );
73 #if QT_VERSION < 0x040000
78 highSlider ->setFocusPolicy ( Qt::WheelFocus );
111 checkboxlayout->setAlignment ( Qt::AlignHCenter );
115 connect (
lowTextBox, SIGNAL ( returnPressed() ),
118 connect (
highTextBox, SIGNAL ( returnPressed () ),
121 connect (
lowSlider, SIGNAL ( sliderReleased () ),
124 connect (
highSlider, SIGNAL ( sliderReleased () ),
127 connect (
lowSlider, SIGNAL ( valueChanged (
int ) ),
130 connect (
highSlider, SIGNAL ( valueChanged (
int ) ),
133 connect (
lowSlider, SIGNAL ( sliderPressed () ),
136 connect (
highSlider, SIGNAL ( sliderPressed () ),
158 const Range & fullRange )
175 currentRange.
setRange ( lo, hi, currentRange.
pos() );
195 if ( position - width / 2 < fullRange.
low() ||
196 position + width / 2 > fullRange.
high() ) {
206 currentRange.
setRange ( position - width / 2,
207 position + width / 2,
208 currentRange.
pos() );
224 currentRange.
setRange ( position - width / 2,
225 position + width / 2,
226 currentRange.
pos() );
259 Range & currentRange,
260 const Range & fullRange )
269 if ( new_low < currentRange.
high() ){
270 currentRange.
setLow ( new_low );
275 double low = currentRange.
low();
287 if ( position - width / 2 < fullRange.
low() ||
288 position + width / 2 > fullRange.
high() ) {
295 currentRange.
setRange ( position - width / 2,
296 position + width / 2,
297 currentRange.
pos() );
307 double oldWidth = fullRange.
length();
309 double position = ( fullRange.
high() + fullRange.
low() ) / 2 ;
313 currentRange.
setRange ( position - width / 2,
314 position + width / 2,
315 currentRange.
pos() );
333 Range & currentRange,
334 const Range & fullRange )
342 if ( new_high > currentRange.
low() ) {
343 currentRange.
setHigh ( new_high );
348 double high = currentRange.
high();
360 currentRange.
setRange ( position - 0.5 * width,
361 position + 0.5 * width,
362 currentRange.
pos() );
372 double oldPosition = ( fullRange.
high() + fullRange.
low() ) / 2 ;
373 double position = ( width *
379 currentRange.
setRange ( position - width / 2,
380 position + width / 2,
381 currentRange.
pos() );
393 const Range & fullRange )
408 double currentWidth = currentRange.
high() - currentRange.
low();
409 double currentPosition
410 = 0.5 * ( currentRange.
high() + currentRange.
low() );
437 double currentWidth = currentRange.
high() - currentRange.
low();
438 double currentPosition
439 = 0.5 * ( currentRange.
high() + currentRange.
low() );
465 =
"Attempt to apply invalid range:\n\n"
467 +
"Low end of range must be less than high end.";
536 const Range & fullRange )
626 const Range & fullRange )
629 = static_cast <
int >(
630 ( value - fullRange.
low() ) /
641 const Range & fullRange )
645 ( value ) / fullRange.
length () *