cFrameSliderPopup::cFrameSliderPopup(QWidget *parent) : QFrame(parent), ui(new Ui::cFrameSliderPopup) { ui->setupUi(this); connect(ui->slider, SIGNAL(sliderReleased()), this, SLOT(sliderReleased())); connect(ui->buClose, SIGNAL(pressed()), this, SLOT(hide())); connect(ui->buDouble, SIGNAL(pressed()), this, SIGNAL(doublePressed())); connect(ui->buHalf, SIGNAL(pressed()), this, SIGNAL(halfPressed())); connect(ui->buInteger, SIGNAL(pressed()), this, SIGNAL(intPressed())); connect(ui->buReset, SIGNAL(pressed()), this, SIGNAL(resetPressed())); connect(ui->buZero, SIGNAL(pressed()), this, SIGNAL(zeroPressed())); sliderTimer = new QTimer(); sliderTimer->setSingleShot(true); connect(sliderTimer, SIGNAL(timeout()), this, SLOT(slotSliderTimerTrigger())); sliderTimer->start(100); integerMax = 0; integerMin = 0; integerMode = false; dialMode = false; dialScale = 1; ui->dial->hide(); ui->buUp->hide(); ui->buRight->hide(); ui->buDown->hide(); ui->buLeft->hide(); }
void MyDoubleSpinBox::focusInEvent(QFocusEvent *event) { QDoubleSpinBox::focusInEvent(event); QString type = GetType(objectName()); if (type != "text") { if (!slider) { QWidget *topWidget = window(); slider = new cFrameSliderPopup(topWidget); slider->setFocusPolicy(Qt::NoFocus); if (type == QString("spinboxd") || type == QString("spinboxd3") || type == QString("spinboxd4")) { int dialScale = pow(10.0, double(decimals())); slider->SetDialMode(dialScale, value()); hasDial = true; } slider->hide(); } QWidget *topWidget = window(); QPoint windowPoint = mapTo(topWidget, QPoint()); int width = this->width(); int hOffset = height(); slider->adjustSize(); QSize minimumSize = slider->minimumSizeHint(); width = max(width, int(minimumSize.width() * 0.6)); slider->setFixedWidth(width); if (windowPoint.y() + slider->height() + hOffset > topWidget->height()) hOffset = -slider->height(); slider->move(windowPoint.x(), windowPoint.y() + hOffset); slider->show(); connect(slider, SIGNAL(resetPressed()), this, SLOT(slotResetToDefault())); connect(slider, SIGNAL(intPressed()), this, SLOT(slotRoundValue())); if (hasDial) { connect(this, SIGNAL(valueChanged(double)), slider, SLOT(slotUpdateValue(double))); connect(slider, SIGNAL(valueChanged(double)), this, SLOT(setValue(double))); connect(slider, SIGNAL(upPressed()), this, SLOT(slotZeroValue())); connect(slider, SIGNAL(downPressed()), this, SLOT(slot180Value())); connect(slider, SIGNAL(rightPressed()), this, SLOT(slot90Value())); connect(slider, SIGNAL(leftPressed()), this, SLOT(slotMinus90Value())); } else { connect(slider, SIGNAL(timerTrigger()), this, SLOT(slotSliderTimerUpdateValue())); connect(slider, SIGNAL(zeroPressed()), this, SLOT(slotZeroValue())); connect(slider, SIGNAL(halfPressed()), this, SLOT(slotHalfValue())); connect(slider, SIGNAL(doublePressed()), this, SLOT(slotDoubleValue())); connect(slider, SIGNAL(minusPressed()), this, SLOT(slotInvertSign())); } }
/** * Constructor. * @param m pointer to main window */ Simulator::Simulator(MainWindow* m) : QObject(m) { main = m; simdlg = new SimulatorDlgImpl((QWidget*)main); current_state=NULL; connect(simdlg, SIGNAL(closing()), this, SLOT(stopSimulation()) ); connect(simdlg, SIGNAL(inputSent()), this, SLOT(next()) ); connect(simdlg, SIGNAL(resetPressed()), this, SLOT(reset()) ); }
EditGain::EditGain(QWidget* parent, int initGainValue) : QDialog(parent) { setupUi(this); sliderGain->setValue(sliderGain->maximum() - initGainValue); connect(buttonReset, SIGNAL(pressed()), this, SLOT(resetPressed())); connect(buttonApply, SIGNAL(pressed()), this, SLOT(applyPressed())); connect(buttonCancel, SIGNAL(pressed()), this, SLOT(cancelPressed())); connect(sliderGain, SIGNAL(valueChanged(int)), this, SLOT(gainChanged(int))); if (sliderGain->value() != 100) buttonReset->setEnabled(true); }
void MyLineEdit::focusInEvent(QFocusEvent *event) { QLineEdit::focusInEvent(event); QString type = GetType(objectName()); if (type != "text") { if (!slider) { QWidget *topWidget = window(); slider = new cFrameSliderPopup(topWidget); slider->setFocusPolicy(Qt::NoFocus); slider->hide(); } QWidget *topWidget = window(); QPoint windowPoint = mapTo(topWidget, QPoint()); int width = this->width(); int hOffset = height(); QSize minimumSize = slider->minimumSizeHint(); width = max(width, int(minimumSize.width() * 0.6)); slider->adjustSize(); slider->setFixedWidth(width); if (windowPoint.y() + slider->height() + hOffset > topWidget->height()) hOffset = -slider->height(); slider->move(windowPoint.x(), windowPoint.y() + hOffset); slider->show(); connect(slider, SIGNAL(timerTrigger()), this, SLOT(slotSliderTimerUpdateValue())); connect(slider, SIGNAL(resetPressed()), this, SLOT(slotResetToDefault())); connect(slider, SIGNAL(zeroPressed()), this, SLOT(slotZeroValue())); connect(slider, SIGNAL(minusPressed()), this, SLOT(slotInvertSign())); connect(slider, SIGNAL(halfPressed()), this, SLOT(slotHalfValue())); connect(slider, SIGNAL(doublePressed()), this, SLOT(slotDoubleValue())); connect(slider, SIGNAL(intPressed()), this, SLOT(slotRoundValue())); } }
EditAllergenWid::EditAllergenWid(QString rootdir, IndexItem olditem_a, QWidget *parent) : QWidget(parent) { //model_old = model_a; old_item=olditem_a; path = rootdir; model = new Allergen(); XAllergen *xml = new XAllergen(model,old_item.getLocation()); xml->readData(); u = new EditUpper(model->getName()); old=model->getName(); m=new EditMiddle(); m->setType(model->getType()); b=new EditBottom(); layout = new QVBoxLayout(this); layout->addWidget(u); layout->addWidget(m); layout->addWidget(b); connect(b,SIGNAL(resetPressed()),this,SLOT(performReset())); connect(b,SIGNAL(savePressed()),this,SLOT(performSave())); }
void MySpinBox::focusInEvent(QFocusEvent *event) { QSpinBox::focusInEvent(event); QString type = GetType(objectName()); if (type != "text") { if (!slider) { QWidget *topWidget = window(); slider = new cFrameSliderPopup(topWidget); slider->setFocusPolicy(Qt::NoFocus); slider->hide(); } // update min and max slider->SetIntegerMode(minimum(), maximum(), value()); QWidget *topWidget = window(); QPoint windowPoint = mapTo(topWidget, QPoint()); int width = this->width(); int hOffset = height(); slider->adjustSize(); slider->setFixedWidth(width); if (windowPoint.y() + slider->height() + hOffset > topWidget->height()) hOffset = -slider->height(); slider->move(windowPoint.x(), windowPoint.y() + hOffset); slider->show(); connect(slider, SIGNAL(resetPressed()), this, SLOT(slotResetToDefault())); connect(slider, SIGNAL(halfPressed()), this, SLOT(slotHalfValue())); connect(slider, SIGNAL(doublePressed()), this, SLOT(slotDoubleValue())); connect(this, SIGNAL(valueChanged(int)), slider, SLOT(slotUpdateValue(int))); connect(slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); } }