Back to index

kdeartwork  4.3.2
Signals | Public Member Functions | Protected Slots | Protected Attributes
KXSRangeControl Class Reference

#include <kxscontrol.h>

Inheritance diagram for KXSRangeControl:
Inheritance graph
[legend]
Collaboration diagram for KXSRangeControl:
Collaboration graph
[legend]

List of all members.

Signals

void changed ()

Public Member Functions

 KXSRangeControl (QWidget *parent, const QString &name, KConfig &config)
 KXSRangeControl (QWidget *parent, const QString &name, const QXmlAttributes &attr)
virtual void read (KConfig &config)
virtual QString command ()
virtual void save (KConfig &config)

Protected Slots

void slotValueChanged (int value)

Protected Attributes

QSlider * mSlider
QSpinBox * mSpinBox
QString mSwitch
int mMinimum
int mMaximum
int mValue
bool mInvert
QString mName
QString mLabel

Detailed Description

Definition at line 39 of file kxscontrol.h.


Constructor & Destructor Documentation

KXSRangeControl::KXSRangeControl ( QWidget *  parent,
const QString &  name,
KConfig &  config 
)

Definition at line 38 of file kxscontrol.cpp.

  : QWidget(parent), KXSRangeItem(name, config), mSlider(0), mSpinBox(0)
{
  QVBoxLayout *l = new QVBoxLayout(this);
  QLabel *label = new QLabel(mLabel, this);
  l->addWidget(label);
  mSlider = new QSlider(Qt::Horizontal, this);
  mSlider->setMinimum(mMinimum);
  mSlider->setMaximum(mMaximum);
  mSlider->setPageStep(10);
  mSlider->setValue(mValue);
  connect(mSlider, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
  l->addWidget(mSlider);
}

Here is the call graph for this function:

KXSRangeControl::KXSRangeControl ( QWidget *  parent,
const QString &  name,
const QXmlAttributes &  attr 
)

Definition at line 54 of file kxscontrol.cpp.

  : QWidget(parent), KXSRangeItem(name, attr), mSlider(0), mSpinBox(0)
{
    if (attr.value("type") == "spinbutton" ) {
       QHBoxLayout *hb = new QHBoxLayout(this);
       if (!mLabel.isEmpty()) {
           QLabel *l = new QLabel(i18n(mLabel.toUtf8()), this);
           hb->addWidget(l);
       }
       mSpinBox = new QSpinBox(this);
        mSpinBox->setMinimum(mMinimum);
        mSpinBox->setMaximum(mMaximum);
        mSpinBox->setSingleStep(1);
       mSpinBox->setValue(mValue);
       connect(mSpinBox, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
       hb->addWidget(mSpinBox);
    } else {
       QString lowLabel = attr.value("_low-label");
       QString highLabel = attr.value("_high-label");
       QVBoxLayout *vb = new QVBoxLayout(this);
       if (!mLabel.isEmpty()) {
           QLabel *l = new QLabel(i18n(mLabel.toUtf8()), this);
           vb->addWidget(l);
       }
       QHBoxLayout *hb = new QHBoxLayout();
        vb->addLayout(hb);
       if (!lowLabel.isEmpty()) {
           QLabel *l = new QLabel(i18n(lowLabel.toUtf8()), this);
           hb->addWidget(l);
       }
       mSlider = new QSlider(Qt::Horizontal, this);
       mSlider->setMinimum(mMinimum);
       mSlider->setMaximum(mMaximum);
       mSlider->setPageStep(10);
       mSlider->setValue(mValue);
       connect(mSlider, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
       hb->addWidget(mSlider);
       if (!highLabel.isEmpty()){
           QLabel *l = new QLabel(i18n(highLabel.toUtf8()), this);
           hb->addWidget(l);
       }
    }
}

Here is the call graph for this function:


Member Function Documentation

void KXSRangeControl::changed ( ) [signal]

Here is the caller graph for this function:

QString KXSRangeItem::command ( ) [virtual, inherited]

Implements KXSConfigItem.

Definition at line 67 of file kxsitem.cpp.

void KXSRangeControl::read ( KConfig &  config) [virtual]

Reimplemented from KXSRangeItem.

Definition at line 105 of file kxscontrol.cpp.

{
    KXSRangeItem::read(config);
    if ( mSpinBox )
       mSpinBox->setValue(mValue);
    else
       mSlider->setValue(mValue);
}
void KXSRangeItem::save ( KConfig &  config) [virtual, inherited]

Implements KXSConfigItem.

Definition at line 79 of file kxsitem.cpp.

{
  KConfigGroup grp = config.group(mName);
  grp.writeEntry("Value", mValue);
}
void KXSRangeControl::slotValueChanged ( int  value) [protected, slot]

Definition at line 99 of file kxscontrol.cpp.

{
  mValue = value;
  emit changed();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bool KXSRangeItem::mInvert [protected, inherited]

Definition at line 61 of file kxsitem.h.

QString KXSConfigItem::mLabel [protected, inherited]

Definition at line 43 of file kxsitem.h.

int KXSRangeItem::mMaximum [protected, inherited]

Definition at line 59 of file kxsitem.h.

int KXSRangeItem::mMinimum [protected, inherited]

Definition at line 58 of file kxsitem.h.

QString KXSConfigItem::mName [protected, inherited]

Definition at line 42 of file kxsitem.h.

QSlider* KXSRangeControl::mSlider [protected]

Definition at line 55 of file kxscontrol.h.

QSpinBox* KXSRangeControl::mSpinBox [protected]

Definition at line 56 of file kxscontrol.h.

QString KXSRangeItem::mSwitch [protected, inherited]

Definition at line 57 of file kxsitem.h.

int KXSRangeItem::mValue [protected, inherited]

Definition at line 60 of file kxsitem.h.


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