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> 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 () *
AxisWidget(QWidget *parent=0, const char *name=0, Qt::WFlags wflags=0)
The standard QWidget constructor.
void highTextReturnPressed()
Emitted when highTextBox gets return pressed.
void invalidRangeError(const std::string &bad)
Throws up a message box when an attempt is made to set an invalid range.
void highSliderValueChanged(int value)
Emitted when highSlider's value has changed.
QLineEdit * highTextBox
The text box that shows the high value.
QScrollBar * getHighSlider()
Returns the high slider.
QLineEdit * lowTextBox
The text box that shows the low value.
double getPositionFromSlider(const Range &fullRange)
Converts the slider position to Position.
int getLowSliderValue()
Get the low slider value.
QLabel * lowTextLabel
The "Low" text label.
void setSlider(QScrollBar *s, double value, const Range &fullRange)
Sets the slider s to the value value.
QLabel * highTextLabel
The "High" text label.
void setSliderZero(QScrollBar *s, double value, const Range &fullRange)
Sets the slider s to the value value, where the slider zero corresponds to data zero.
QScrollBar * lowSlider
The low slider.
toDouble(bool *ok=0) const
void lowTextReturnPressed()
Emitted when lowTextBox gets return pressed.
virtual ~AxisWidget()
The required virtual destructor.
void processHighSliderMoved(int value, Range ¤tRange, const Range &fullRange)
Called by InspectorBase in response to the highSliderMoved signal.
double high() const
Returns the maximum of the range object.
void setHigh(double x)
Sets the maximum of the range object.
void highSliderReleased()
Emitted when highSlider is released.
double getLowFromSlider(const Range &fullRange)
Converts the slider position to Low.
void processLowSliderReleased(const Range &fullRange)
Called by InspectorBase in response to the lowSliderReleased signal.
void setAllDisabled(bool flag)
Enable all controls if flag = false, disable if true.
void processLowSliderMoved(int value, Range ¤tRange, const Range &fullRange)
Called by InspectorBase in response to the lowSliderMoved signal.
void lowSliderReleased()
Emitted when lowSlider is released.
void setLowSliderValue(int value)
Set the low slider value.
double length() const
Returns the length of the range object.
void processHighSliderReleased(const Range &fullRange)
Called by InspectorBase in response to the highSliderReleased signal.
void processZoomPanCheckBoxClicked(const Range ¤tRange, const Range &fullRange)
Called by InspectorBase in response to the zoomPanCheckBoxClicked signal.
void lowSliderValueChanged(int value)
Emitted when lowSlider's value has changed.
void setLowText(const QString &s, bool readonly=false)
Set the text in the lowTextBox.
bool m_isCut
A boolean that is true if the AxisWidget controls a cut.
void highSliderPressed()
Emitted when highSlider is pressed.
void setLow(double x)
Sets the minimum of the range object.
double low() const
Returns the minimum of the range object.
int getHighSliderValue()
Get the high slider value.
void processTextBoxReturnPressed(Range ¤tRange, const Range &fullRange)
Called by InspectorBase in response to the lowTextReturnPressed and highTextReturnPressed signals...
void setRange(double low, double high, double pos)
Changes the current Range.
hippodraw::AxisWidget class interface
Expresses a range of values.
void setHighText(const QString &s, bool readonly=false)
Set the text in the highTextBox.
void setCut(bool flag)
Set the isCut flag.
void setHighSliderValue(int value)
Set the high slider value.
bool isZoomPanChecked()
Returns whether zoomPanCheckBox is checked.
void zoomPanCheckBoxClicked()
Emitted when zoomPanCheckBox is clicked.
QScrollBar * getLowSlider()
Returns the low slider widget.
critical(QWidget *parent, const QString &caption, const QString &text, int button0, int button1, int button2=0)
QCheckBox * zoomPanCheckBox
The zoom pan check box.
double getHighFromSlider(const Range &fullRange)
Converts the slider position to High.
void lowSliderPressed()
Emitted when lowSlider is pressed.
double pos() const
Returns the first positive element in range.
double getWidthFromSlider(const Range &fullRange)
Converts the slider position to Width.
QScrollBar * highSlider
The high slider.
void updateCutControlValues(const Range ¤tRange, const Range &fullRange)
Set the textboxes and sliders to the values given by the arguments.
void setZoomPan(bool check, bool disables=false)
Checks zoomPanCheckBox if check is true, else un-checks it.
hippodraw::Range class interface