PlaybackSlider::PlaybackSlider(QWidget* parent) : QWidget(parent) , m_select(NULL) , m_value(NULL) , m_slider(NULL) , m_label(NULL) , m_flash(NULL) , m_previousValue(-1) { new QVBoxLayout(this); layout()->setSpacing(1); layout()->setContentsMargins(1, 1, 1, 1); /* Select button */ m_select = new QToolButton(this); m_select->setIcon(QIcon(":/check.png")); m_select->setIconSize(QSize(32, 32)); m_select->setToolTip(tr("Select")); layout()->addWidget(m_select); layout()->setAlignment(m_select, Qt::AlignHCenter); connect(m_select, SIGNAL(clicked()), this, SIGNAL(selected())); /* Value label */ m_value = new QLabel(this); m_value->setAlignment(Qt::AlignHCenter); layout()->addWidget(m_value); layout()->setAlignment(m_value, Qt::AlignHCenter); /* Value slider */ m_slider = new QSlider(this); m_slider->setRange(0, UCHAR_MAX); m_slider->setTickInterval(16); m_slider->setTickPosition(QSlider::TicksBothSides); m_slider->setStyle(AppUtil::saneStyle()); layout()->addWidget(m_slider); layout()->setAlignment(m_slider, Qt::AlignHCenter); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderChanged(int))); /* Label */ m_label = new QLabel(this); m_label->setWordWrap(true); layout()->addWidget(m_label); layout()->setAlignment(m_label, Qt::AlignHCenter); /* Flash button */ m_flash = new QToolButton(this); m_flash->setIcon(QIcon(":/flash.png")); m_flash->setIconSize(QSize(32, 32)); m_flash->setToolTip(tr("Flash")); layout()->addWidget(m_flash); layout()->setAlignment(m_flash, Qt::AlignHCenter); connect(m_flash, SIGNAL(pressed()), this, SLOT(slotFlashPressed())); connect(m_flash, SIGNAL(released()), this, SLOT(slotFlashReleased())); slotSliderChanged(0); }
DMXSlider::DMXSlider(QWidget* parent) : QWidget(parent) , m_edit(NULL) , m_slider(NULL) , m_label(NULL) { new QVBoxLayout(this); layout()->setSpacing(1); layout()->setContentsMargins(1, 1, 1, 1); /* Value editor */ m_edit = new QLineEdit(this); m_edit->setMaxLength(3); m_edit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); m_edit->setAlignment(Qt::AlignHCenter); QIntValidator* validator = new QIntValidator(m_edit); validator->setRange(0, UCHAR_MAX); m_edit->setValidator(validator); layout()->addWidget(m_edit); layout()->setAlignment(m_edit, Qt::AlignHCenter); connect(m_edit, SIGNAL(textEdited(QString)), this, SLOT(slotValueEdited(QString))); /* Value slider */ m_slider = new QSlider(this); m_slider->setRange(0, UCHAR_MAX); m_slider->setTickInterval(16); m_slider->setTickPosition(QSlider::TicksBothSides); m_slider->setStyle(AppUtil::saneStyle()); layout()->addWidget(m_slider); layout()->setAlignment(m_slider, Qt::AlignRight); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderChanged(int))); /* Label */ m_label = new QLabel(this); m_label->setWordWrap(true); layout()->addWidget(m_label); layout()->setAlignment(m_label, Qt::AlignHCenter); slotSliderChanged(0); }
void ParameterSlider::setSliderValue(int value) { m_ui->slider->setValue(value); slotSliderChanged(value); }
void ParameterSlider::setSliderPosition(int pos) { m_ui->slider->setValue(pos); slotSliderChanged(pos); }