casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
casa::QtSliderBase Class Referenceabstract

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

#include <QtGuiEntry.qo.h>

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

Signals

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

Public Member Functions

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

Protected Slots

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

Protected Member Functions

 QtSliderBase (QWidget *parent=0)
 Only for use by derived classes. More...
 
 ~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. More...
 
void getAttr (const QDomElement &ele, QString attnm, double &val)
 Fetch numeric value of attribute of ele named attnm, into val. More...
 
virtual void updateText ()=0
 Derived class should implement: set value text box or label (if any) to (normalized) current value. More...
 
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_]. More...
 
int sliderVal (double extVal)
 
QString toText (double val)
 These two routines convert 'external' values between double and text. More...
 
double toNumber (QString text, bool *ok=0)
 
QString textVal ()
 Current external value, as text. More...
 
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_). More...
 
void updateSlider ()
 Sets slider to latest range and value (without triggering slider signals or slChg slot below). More...
 
void emitVal ()
 emit current value – widget's main output. More...
 
void update (double dval)
 Accepts new value (if any), updates interface (without retriggering any internal slots). More...
 

Protected Attributes

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

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 109 of file QtGuiEntry.qo.h.

Constructor & Destructor Documentation

casa::QtSliderBase::QtSliderBase ( QWidget *  parent = 0)
inlineprotected

Only for use by derived classes.

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

casa::QtSliderBase::~QtSliderBase ( )
inlineprotected

Definition at line 139 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 casacore::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 ( casacore::String  errmsg)
signal

class user may wish to connect to and display these.

double casa::QtSliderBase::externalVal ( int  sldVal)
inlineprotected

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 194 of file QtGuiEntry.qo.h.

References dIncr_, dMax_, dMin_, casacore::max(), and casacore::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 123 of file QtGuiEntry.qo.h.

References itemName.

virtual void casa::QtSliderBase::release ( )
inlineprotectedvirtualslot

Definition at line 161 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)
inlineprotected

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

Referenced by sliderVal().

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

Set interface label text ('listname').

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

References nameLabel_.

virtual void casa::QtSliderBase::setOriginal ( )
protectedvirtualslot

'revert-to-original' selected in menu.

virtual void casa::QtSliderBase::slChg ( int  slval)
inlineprotectedvirtualslot

slider changed by user

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

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

int casa::QtSliderBase::sliderVal ( double  extVal)
inlineprotected

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

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

QString casa::QtSliderBase::textVal ( )
inlineprotected

Current external value, as text.

Definition at line 211 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 ( )
protectedpure 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

double casa::QtSliderBase::dIncr0_
protected

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

double casa::QtSliderBase::dIncr_
protected

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

Referenced by externalVal(), and sliderVal().

double casa::QtSliderBase::dMax_
protected

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

Referenced by externalVal().

double casa::QtSliderBase::dMin_
protected

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

Referenced by externalVal(), and sliderVal().

double casa::QtSliderBase::dVal_
protected

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 243 of file QtGuiEntry.qo.h.

Referenced by textVal().

bool casa::QtSliderBase::floatrng_
protected

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

ints (ptype 'intrange').

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

QString casa::QtSliderBase::itemName
protected

Internal name ('dlformat').

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

Referenced by name().

QToolButton* casa::QtSliderBase::menuBtn_
protected

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

QLabel* casa::QtSliderBase::nameLabel_
protected

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

Referenced by setLabelText().

bool casa::QtSliderBase::onrelease_
protected

Should the event be generated only upon releasing the slider?

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

Referenced by release(), and slChg().

double casa::QtSliderBase::origVal_
protected

For restoring 'original' value.

Definition at line 253 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 258 of file QtGuiEntry.qo.h.

double casa::QtSliderBase::slMax_
protected

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

Referenced by sliderVal().


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