Back to index

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

#include <kxscontrol.h>

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

List of all members.

Signals

void changed ()

Public Member Functions

 KXSDoubleRangeControl (QWidget *parent, const QString &name, KConfig &config)
 KXSDoubleRangeControl (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
double mStep
QString mSwitch
double mMinimum
double mMaximum
double mValue
bool mInvert
QString mName
QString mLabel

Detailed Description

Definition at line 60 of file kxscontrol.h.


Constructor & Destructor Documentation

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

Definition at line 115 of file kxscontrol.cpp.

  : QWidget(parent), KXSDoubleRangeItem(name, config)
{
  QVBoxLayout *l = new QVBoxLayout(this);
  QLabel *label = new QLabel(mLabel, this);
  l->addWidget(label);

  int value = int((mValue - mMinimum) * 100 / (mMaximum - mMinimum));

  mSlider = new QSlider(Qt::Horizontal, this);
  mSlider->setMinimum(0);
  mSlider->setMaximum(100);
  mSlider->setPageStep(10);
  mSlider->setValue(value);
  connect(mSlider, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
  l->addWidget(mSlider);
}

Here is the call graph for this function:

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

Definition at line 134 of file kxscontrol.cpp.

  : QWidget(parent), KXSDoubleRangeItem(name, attr)
{
    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);
    }
    int value = int((mValue - mMinimum) * 100 / (mMaximum - mMinimum));
    mSlider = new QSlider(Qt::Horizontal, this);
    mSlider->setMinimum(0);
    mSlider->setMaximum(100);
    mSlider->setPageStep(10);
    mSlider->setValue(value);
    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 KXSDoubleRangeControl::changed ( ) [signal]

Here is the caller graph for this function:

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

Implements KXSConfigItem.

Definition at line 112 of file kxsitem.cpp.

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

Reimplemented from KXSDoubleRangeItem.

Definition at line 171 of file kxscontrol.cpp.

{
    KXSDoubleRangeItem::read(config);
    mSlider->setValue((int)((mValue - mMinimum) * 100.0 /
                            (mMaximum - mMinimum) + 0.5));
}
void KXSDoubleRangeItem::save ( KConfig &  config) [virtual, inherited]

Implements KXSConfigItem.

Definition at line 124 of file kxsitem.cpp.

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

Definition at line 165 of file kxscontrol.cpp.

{
  mValue = mMinimum + value * (mMaximum - mMinimum) / 100.0;
  emit changed();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bool KXSDoubleRangeItem::mInvert [protected, inherited]

Definition at line 79 of file kxsitem.h.

QString KXSConfigItem::mLabel [protected, inherited]

Definition at line 43 of file kxsitem.h.

double KXSDoubleRangeItem::mMaximum [protected, inherited]

Definition at line 77 of file kxsitem.h.

double KXSDoubleRangeItem::mMinimum [protected, inherited]

Definition at line 76 of file kxsitem.h.

QString KXSConfigItem::mName [protected, inherited]

Definition at line 42 of file kxsitem.h.

QSlider* KXSDoubleRangeControl::mSlider [protected]

Definition at line 76 of file kxscontrol.h.

double KXSDoubleRangeControl::mStep [protected]

Definition at line 77 of file kxscontrol.h.

QString KXSDoubleRangeItem::mSwitch [protected, inherited]

Definition at line 75 of file kxsitem.h.

double KXSDoubleRangeItem::mValue [protected, inherited]

Definition at line 78 of file kxsitem.h.


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