casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes
casa::QtSliderBase Class Reference

Base class for QtAutoGui slider interface elements. More...

#include <QtGuiEntry.qo.h>

Inheritance diagram for casa::QtSliderBase:
casa::QtSliderEditor casa::QtSliderLabel

List of all members.

Signals

void itemValueChanged (QString name, QString value, int action, bool apply)
 Main output signal.
void errMsg (String errmsg)
 class user may wish to connect to and display these.

Public Member Functions

void setLabelText (QString txt)
 Set interface label text ('listname').
QString name ()
 Internal name ('dlformat')
void reSet (QDomElement &ele)
 Set up main state (value, etc.) and external appearance of this widget, according to options record (passed as a QDomElement).

Protected Slots

virtual void slChg (int slval)
 slider changed by user
virtual void release ()
virtual void setOriginal ()
 'revert-to-original' selected in menu.

Protected Member Functions

 QtSliderBase (QWidget *parent=0)
 Only for use by derived classes.
 ~QtSliderBase ()
void constructBase (QDomElement &ele, QSlider *slider, QLabel *nameLabel, QToolButton *menuBtn)
 Derived class should call this within its constructor, after it has a valid QSlider, name QLabel and menu QToolButton (usually, after calling setUi()), passing them down in the parameters below.
void getAttr (const QDomElement &ele, QString attnm, Double &val)
 Fetch numeric value of attribute of ele named attnm, into val.
virtual void updateText ()=0
 Derived class should implement: set value text box or label (if any) to (normalized) current value.
Int round (Double val)
Double externalVal (Int sldVal)
 Integer values with in [0, slMax_] on the internal slider are scaled to external values within [dMin_, dMax_].
Int sliderVal (Double extVal)
QString toText (Double val)
 These two routines convert 'external' values between Double and text.
Double toNumber (QString text, bool *ok=0)
QString textVal ()
 Current external value, as text.
void adjSlIncr ()
 Adjusts integer slider range (slMax_) and the increment that each unit on the slider represents (dIncr_), according to latest increment and range request (dIncr0_, dMin_, dMax_).
void updateSlider ()
 Sets slider to latest range and value (without triggering slider signals or slChg slot below).
void emitVal ()
 emit current value -- widget's main output.
void update (Double dval)
 Accepts new value (if any), updates interface (without retriggering any internal slots).

Protected Attributes

Double dVal_
 main state.
Double dMin_
Double dMax_
Double dIncr_
Double dIncr0_
Double slMax_
Bool floatrng_
 Whether this element emits float values (ptype 'floatrange') vs.
bool onrelease_
 Should the event be generated only upon releasing the slider?
Double origVal_
 For restoring 'original' value.
QSlider * slider_
 Relevant user interface elements.
QLabel * nameLabel_
QToolButton * menuBtn_
QString itemName
 Internal name ('dlformat').

Detailed Description

Base class for QtAutoGui slider interface elements.

Synopsis

This is a base with common functionality for the two slider 'guientries': QtSliderEditor, which has a value edit box, and QtSliderLabel, with a non-editable value label. This class is abstract; its constructor can only be called by a derived class. That class should also call constructBase() after cxreating its interface elements, to complete construction.

Definition at line 107 of file QtGuiEntry.qo.h.


Constructor & Destructor Documentation

casa::QtSliderBase::QtSliderBase ( QWidget *  parent = 0) [inline, protected]

Only for use by derived classes.

Definition at line 132 of file QtGuiEntry.qo.h.

casa::QtSliderBase::~QtSliderBase ( ) [inline, protected]

Definition at line 133 of file QtGuiEntry.qo.h.


Member Function Documentation

void casa::QtSliderBase::adjSlIncr ( ) [protected]

Adjusts integer slider range (slMax_) and the increment that each unit on the slider represents (dIncr_), according to latest increment and range request (dIncr0_, dMin_, dMax_).

void casa::QtSliderBase::constructBase ( QDomElement &  ele,
QSlider *  slider,
QLabel *  nameLabel,
QToolButton *  menuBtn 
) [protected]

Derived class should call this within its constructor, after it has a valid QSlider, name QLabel and menu QToolButton (usually, after calling setUi()), passing them down in the parameters below.

ele is the QDomElement (an xml version of an option Record) used to construct the derived class.

void casa::QtSliderBase::emitVal ( ) [protected]

emit current value -- widget's main output.

Referenced by release(), and slChg().

void casa::QtSliderBase::errMsg ( String  errmsg) [signal]

class user may wish to connect to and display these.

Double casa::QtSliderBase::externalVal ( Int  sldVal) [inline, protected]

Integer values with in [0, slMax_] on the internal slider are scaled to external values within [dMin_, dMax_].

These two routines convert between the two scalings.

Definition at line 182 of file QtGuiEntry.qo.h.

References dIncr_, dMax_, dMin_, casa::max(), and casa::min().

Referenced by slChg().

void casa::QtSliderBase::getAttr ( const QDomElement &  ele,
QString  attnm,
Double val 
) [protected]

Fetch numeric value of attribute of ele named attnm, into val.

Does nothing if attr doesn't exist or is not valid numerically.

void casa::QtSliderBase::itemValueChanged ( QString  name,
QString  value,
int  action,
bool  apply 
) [signal]

Main output signal.

Main parameters of interest are item name and new value.

QString casa::QtSliderBase::name ( ) [inline]

Internal name ('dlformat')

Definition at line 119 of file QtGuiEntry.qo.h.

References itemName.

virtual void casa::QtSliderBase::release ( ) [inline, protected, virtual, slot]

Definition at line 153 of file QtGuiEntry.qo.h.

References emitVal(), and onrelease_.

void casa::QtSliderBase::reSet ( QDomElement &  ele)

Set up main state (value, etc.) and external appearance of this widget, according to options record (passed as a QDomElement).

Called via constructor, and from QtAutoGui::changeOptions(). Does not trigger (significant) signals; it is intended to set this interface element to library's internal value (not vice versa).

Int casa::QtSliderBase::round ( Double  val) [inline, protected]

Definition at line 176 of file QtGuiEntry.qo.h.

Referenced by sliderVal().

void casa::QtSliderBase::setLabelText ( QString  txt) [inline]

Set interface label text ('listname').

Definition at line 116 of file QtGuiEntry.qo.h.

References nameLabel_.

virtual void casa::QtSliderBase::setOriginal ( ) [protected, virtual, slot]

'revert-to-original' selected in menu.

virtual void casa::QtSliderBase::slChg ( int  slval) [inline, protected, virtual, slot]

slider changed by user

Definition at line 151 of file QtGuiEntry.qo.h.

References emitVal(), externalVal(), onrelease_, and update().

Int casa::QtSliderBase::sliderVal ( Double  extVal) [inline, protected]

Definition at line 185 of file QtGuiEntry.qo.h.

References dIncr_, dMin_, casa::max(), casa::min(), round(), and slMax_.

QString casa::QtSliderBase::textVal ( ) [inline, protected]

Current external value, as text.

Definition at line 197 of file QtGuiEntry.qo.h.

References dVal_, and toText().

Referenced by casa::QtSliderEditor::updateText().

Double casa::QtSliderBase::toNumber ( QString  text,
bool *  ok = 0 
) [protected]
QString casa::QtSliderBase::toText ( Double  val) [protected]

These two routines convert 'external' values between Double and text.

Referenced by textVal().

void casa::QtSliderBase::update ( Double  dval) [protected]

Accepts new value (if any), updates interface (without retriggering any internal slots).

New value should already have been validated.

Referenced by slChg().

void casa::QtSliderBase::updateSlider ( ) [protected]

Sets slider to latest range and value (without triggering slider signals or slChg slot below).

virtual void casa::QtSliderBase::updateText ( ) [protected, pure virtual]

Derived class should implement: set value text box or label (if any) to (normalized) current value.

(Should not trigger class's own slots).

Implemented in casa::QtSliderLabel, and casa::QtSliderEditor.


Member Data Documentation

Definition at line 227 of file QtGuiEntry.qo.h.

Definition at line 227 of file QtGuiEntry.qo.h.

Referenced by externalVal(), and sliderVal().

Definition at line 227 of file QtGuiEntry.qo.h.

Referenced by externalVal().

Definition at line 227 of file QtGuiEntry.qo.h.

Referenced by externalVal(), and sliderVal().

main state.

Determines the float scaling for the (necessarily int) QSlider. dVal_ is the slider's 'external' value (which may be floating-point). dMin_ and dMax_ are its 'external' range. dIncr0_ is the requested 'external' slider increment ('presolution'), dIncr_ is the increment actually used (normally, these will be the same).

Internally, the slider's range will be [0, slMax_]; slMax_ will be a non-negative integer value. Both of the QSlider's internal increments (singleStep, pageStep) will be 1.

Definition at line 227 of file QtGuiEntry.qo.h.

Referenced by textVal().

Whether this element emits float values (ptype 'floatrange') vs.

ints (ptype 'intrange').

Definition at line 231 of file QtGuiEntry.qo.h.

QString casa::QtSliderBase::itemName [protected]

Internal name ('dlformat').

Definition at line 248 of file QtGuiEntry.qo.h.

Referenced by name().

QToolButton* casa::QtSliderBase::menuBtn_ [protected]

Definition at line 244 of file QtGuiEntry.qo.h.

QLabel* casa::QtSliderBase::nameLabel_ [protected]

Definition at line 243 of file QtGuiEntry.qo.h.

Referenced by setLabelText().

Should the event be generated only upon releasing the slider?

Definition at line 234 of file QtGuiEntry.qo.h.

Referenced by release(), and slChg().

For restoring 'original' value.

Definition at line 237 of file QtGuiEntry.qo.h.

QSlider* casa::QtSliderBase::slider_ [protected]

Relevant user interface elements.

Must be created by derived class and passed in via constructBase().

Definition at line 242 of file QtGuiEntry.qo.h.

Definition at line 227 of file QtGuiEntry.qo.h.

Referenced by sliderVal().


The documentation for this class was generated from the following file: