Example #1
0
// GRID PAGE //
GridPage::GridPage(QWidget* parent, QSettings* appSettings) :
    QWidget(parent),
    m_pAppSettings(appSettings)
{
    QLabel* gridColor = new QLabel("Grid Color", this);
    ColorWidget* gridColorSelect = new ColorWidget(this);

    QLabel* gridSize = new QLabel("Grid Size", this);
    QSpinBox* sizeSpinBox = new QSpinBox;
    sizeSpinBox->setRange(0, 200);
    sizeSpinBox->setSingleStep(1);
    sizeSpinBox->setValue(16);

    QLabel* gridCellSize = new QLabel("Grid Cell Size", this);
    QSpinBox* cellSizeSpinBox = new QSpinBox;
    cellSizeSpinBox->setRange(1, 200);
    cellSizeSpinBox->setSingleStep(1);
    cellSizeSpinBox->setValue(1);

    QGroupBox* gridGroup = new QGroupBox();

    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->addWidget(gridColor, 0, 0);
    gridLayout->addWidget(gridColorSelect, 0, 1);
    gridLayout->addWidget(gridSize, 1, 0);
    gridLayout->addWidget(sizeSpinBox, 1, 1);
    gridLayout->addWidget(gridCellSize, 2, 0);
    gridLayout->addWidget(cellSizeSpinBox, 2, 1);
    gridGroup->setLayout(gridLayout);

    QVBoxLayout* mainLayout = new QVBoxLayout;
    mainLayout->addWidget(gridGroup);
    mainLayout->addStretch(1);
    setLayout(mainLayout);

    // Populate the settings
    gridColorSelect->setColor(m_pAppSettings->value("GLModelWidget/gridColor",
                                                    QColor(0,0,0)).value<QColor>());
    sizeSpinBox->setValue(m_pAppSettings->value("GLModelWidget/gridSize", 16).toInt());
    cellSizeSpinBox->setValue(m_pAppSettings->value("GLModelWidget/gridCellSize", 1).toInt());

    // Backup original values
    m_gridColorOrig = gridColorSelect->color();
    m_gridSizeOrig = sizeSpinBox->value();
    m_gridCellSizeOrig = cellSizeSpinBox->value();

    // Hook up the signals
    QObject::connect(gridColorSelect, SIGNAL(colorChanged(QColor)),
                     this, SLOT(setGridColor(QColor)));
    QObject::connect(sizeSpinBox, SIGNAL(valueChanged(int)),
                     this, SLOT(setGridSize(int)));
    QObject::connect(cellSizeSpinBox, SIGNAL(valueChanged(int)),
                     this, SLOT(setgridCellSize(int)));
}
Example #2
0
void ShaderSelector::addUniform(QGridLayout* settings, const QString& section, const QString& name, int* value, int min, int max, int y, int x) {
	QSpinBox* i = new QSpinBox;
	if (min < max) {
		i->setMinimum(min);
		i->setMaximum(max);
	}
	int def = *value;
	bool ok = false;
	int v = m_config->getQtOption(name, section).toInt(&ok);
	if (ok) {
		*value = v;
	}
	i->setValue(*value);
	i->setSingleStep(1);
	i->setAccelerated(true);
	settings->addWidget(i, y, x);
	connect(i, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [value](int v) {
		*value = v;
	});
	connect(this, &ShaderSelector::saved, [this, section, name, i]() {
		m_config->setQtOption(name, i->value(), section);
	});
	connect(this, &ShaderSelector::reset, [this, section, name, i]() {
		bool ok = false;
		int v = m_config->getQtOption(name, section).toInt(&ok);
		if (ok) {
			i->setValue(v);
		}
	});
	connect(this, &ShaderSelector::resetToDefault, [def, section, name, i]() {
		i->setValue(def);
	});
}
Example #3
0
//-----------------------------------------------------------------------------
void DatPanel::hist()
{
	QLabel *l;
	QLineEdit *id, *v1, *v2;
	QSpinBox *nm;
	QPushButton *b;
	QDialog *d = new QDialog(this);	d->setWindowTitle(tr("UDAV - Make histogram"));
	QGridLayout *g = new QGridLayout(d);
	l = new QLabel(tr("From"), d);	g->addWidget(l,0,0);
	l = new QLabel(tr("To"), d);	g->addWidget(l,0,1);
	v1 = new QLineEdit(d);	g->addWidget(v1,1,0);
	v2 = new QLineEdit(d);	g->addWidget(v2,1,1);
	l = new QLabel(tr("Number of points"), d);	g->addWidget(l,2,0);
	l = new QLabel(tr("Put in variable"), d);	g->addWidget(l,2,1);
	nm = new QSpinBox(d);	nm->setRange(2,8192);	g->addWidget(nm,3,0);
	id = new QLineEdit(d);	nm->setSingleStep(10);	g->addWidget(id,3,1);
	b = new QPushButton(tr("Cancel"), d);	g->addWidget(b,4,0);
	connect(b, SIGNAL(clicked()), d, SLOT(reject()));
	b = new QPushButton(tr("OK"), d);		g->addWidget(b,4,1);
	connect(b, SIGNAL(clicked()), d, SLOT(accept()));	b->setDefault(true);
	// now execute dialog and get values
	bool res = d->exec();
	if(res && !v1->text().isEmpty() && !v2->text().isEmpty() && !id->text().isEmpty())
	{
		mglData *vv = dynamic_cast<mglData*>(parser.AddVar(id->text().toLocal8Bit().constData()));
		if(vv)	vv->Set(mgl_data_hist(var, nm->value(), v1->text().toDouble(), v2->text().toDouble(),0));
		updateDataItems();
	}
}
Example #4
0
/*! 
 * Makes a labeled spin box, with the label given by [text] to the left of the
 * box and right aligned to it, provided that [layout] is a horizontal layout 
 * box in which to place them.  (In a toolbar, [layout] can be NULL.)  
 * [minValue], [maxValue], and [step] are the  minimum, maximum, and step 
 * sizes for the spin box.  If [nDecimal] is non-zero, it creates and returns 
 * a QDoubleSpinBox with that number of decimal places.  It skips the label
 * if [text] is NULL.  The focus policy is set to ClickFocus.  Keyboard 
 * tracking is turned off.  If a pointer is supplied in the optional argument [labelPtr]
 * (which is NULL by default), it is returned with the label pointer.
 */
QAbstractSpinBox *diaLabeledSpin(int nDecimal, float minValue, float maxValue,
                                 float step, const char *text, QWidget *parent,
                                 QBoxLayout *layout, QLabel **labelPtr)
{
  QSpinBox *spin;
  QDoubleSpinBox *fspin;
  if (text) {
    QLabel *label = diaLabel(text, parent, layout);
    label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    if (labelPtr)
      *labelPtr = label;
  }
  if (nDecimal) {
    fspin = new QDoubleSpinBox(parent);
    fspin->setDecimals(nDecimal);
    fspin->setRange((double)minValue, (double)maxValue);
    fspin->setSingleStep((double)step);
    spin = (QSpinBox *)fspin;
  } else {
    spin = new QSpinBox(parent);
    spin->setRange(B3DNINT(minValue), B3DNINT(maxValue));
    spin->setSingleStep(B3DNINT(step));
  }
  if (layout)
    layout->addWidget(spin);
  spin->setFocusPolicy(Qt::ClickFocus);
  spin->setKeyboardTracking(false);
  return (QAbstractSpinBox *)spin;
}
// Creates the property widgets
//NOTE: Add to the switch statement below if you need to add
//      new property types
QWidget* FilterSettingWidget::createPropertyWidget(
		const FilterProperty& p,
		const QString& curValue,
		PropertyAdaptor* adaptor)
{
	QWidget *tmp = 0;

	switch (p.type) {
		case INT_RANGE:
			{
				QSpinBox *spin = new QSpinBox(this);
				tmp = spin;
				spin->setMinimum(p.intMin);
				spin->setMaximum(p.intMax);
				spin->setSingleStep(p.intStep);
				spin->setValue(curValue.toInt());

				connect(spin, SIGNAL(valueChanged(const QString&)),
						adaptor, SLOT(valueChanged(const QString&)));
			}
			break;
		case FLOAT_RANGE:
			{
				QDoubleSpinBox *spin = new QDoubleSpinBox(this);
				tmp = spin;
				spin->setMinimum(p.floatMin);
				spin->setMaximum(p.floatMax);
				spin->setSingleStep(p.floatStep);
				spin->setValue(curValue.toDouble());

				connect(spin, SIGNAL(valueChanged(const QString&)),
						adaptor, SLOT(valueChanged(const QString&)));
			}
			break;
		case STR_SELECTION:
			{
				QComboBox *combo = new QComboBox(this);
				tmp = combo;
				QStringList options =
					QString::fromStdString(p.options)
					.split("\n", QString::SkipEmptyParts);

				combo->addItems(options);

				int index = 0;
				foreach (QString option, options) {
					if (option == curValue) {
						combo->setCurrentIndex(index);
						break;
					}
					++index;
				}

				connect(combo, SIGNAL(currentIndexChanged(const QString&)),
						adaptor, SLOT(valueChanged(const QString&)));
			}
			break;
	}
	return tmp;
}
Example #6
0
QWidget* Sis3350UI::createTriggerThresholdControls()
{
    // Trigger Threshold Controls
    QWidget *box = new QWidget(this);
    QSignalMapper *mapper = new QSignalMapper();
    QHBoxLayout *l = new QHBoxLayout();
    l->setMargin(0);

    thresholds = new QList<QSpinBox*>();
    QLabel *label = new QLabel(tr("Thr:"),this);

    l->addWidget(label);

    for(int i=0; i<4; i++)
    {
        QSpinBox *thr = new QSpinBox(this);
        thr->setMinimum(0);
        thr->setMaximum(0xFFF);
        thr->setAccelerated(true);
        thr->setSingleStep(10);
        thr->setValue(module->conf.trigger_threshold[i]);
        thresholds->append(thr);
        connect(thr,SIGNAL(valueChanged(int)),mapper,SLOT(map()));
        mapper->setMapping(thr,i);
        l->addWidget(thr);
    }
    connect(mapper,SIGNAL(mapped(int)),this,SLOT(thrChanged(int)));
    box->setLayout(l);
    return box;
}
Example #7
0
QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
	QSpinBox *w = qobject_cast<QSpinBox*>(QStyledItemDelegate::createEditor(parent, option, index));
	w->setRange(min,max);
	w->setSingleStep(step);
	return w;
}
/**
 * @brief Initializes the simple integer fields.
 */
void EditEntityDialog::initialize_simple_integers() {

  simple_integer_fields <<
    SimpleIntegerField("price", tr("Price"), 0, 10, ui.font_field) <<
    SimpleIntegerField("jump_length", tr("Jump length"), 16, 8) <<
    SimpleIntegerField("speed", tr("Speed"), 1, 8);

  for (SimpleIntegerField& field : simple_integer_fields) {
    if (entity_before.has_field(field.field_name)) {
      QLabel* label = new QLabel(field.label_text, this);
      QSpinBox* spinbox = new QSpinBox(this);
      spinbox->setMinimum(field.minimum);
      spinbox->setMaximum(999999);
      spinbox->setValue(entity_before.get_field(field.field_name).toInt());
      spinbox->setSingleStep(field.step);
      spinbox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
      field.spinbox = spinbox;
      if (field.before_widget != nullptr) {
        int row = 0;
        QFormLayout::ItemRole role;
        ui.form_layout->getWidgetPosition(field.before_widget, &row, &role);
        if (row != -1) {
          ui.form_layout->insertRow(row, label, spinbox);
        }
        else {
          // Widget not found.
          ui.form_layout->addRow(label, spinbox);
        }
      }
      else {
        ui.form_layout->addRow(label, spinbox);
      }
    }
  }
}
Example #9
0
QWidget* Sis3350UI::createInputOffsetControls()
{
    // Trigger Offset spinners
    QWidget *box = new QWidget(this);
    QSignalMapper *mapper = new QSignalMapper();
    QHBoxLayout *l = new QHBoxLayout();
    l->setMargin(0);

    offsets = new QList<QSpinBox*>();
    QLabel *label = new QLabel(tr("Offset:"),this);

    l->addWidget(label);

    for(int i=0; i<4; i++)
    {
        QSpinBox *off = new QSpinBox(this);
        off->setMinimum(0);
        off->setMaximum(65535);
        off->setAccelerated(true);
        off->setSingleStep(10);
        off->setValue(module->conf.adc_offset[i]);
        connect(off,SIGNAL(valueChanged(int)),mapper,SLOT(map()));
        mapper->setMapping(off,i);
        l->addWidget(off);
        offsets->append(off);
    }
    connect(mapper,SIGNAL(mapped(int)),this,SLOT(offChanged(int)));
    box->setLayout(l);
    return box;
}
Example #10
0
//-----------------------------------------------------------------------------
// Function: AdHocBoundsDelegate::createEditor()
//-----------------------------------------------------------------------------
QWidget* AdHocBoundsDelegate::createEditor(QWidget* parent, QStyleOptionViewItem const& option,
                                           QModelIndex const& index) const
{
    // if the column is the one specified for direction items 
    switch (index.column())
    {
    case ADHOC_BOUNDS_COL_NAME:
        {
            QLabel* label = new QLabel(parent);
            return label;
        }

    case ADHOC_BOUNDS_COL_LEFT:
    case ADHOC_BOUNDS_COL_RIGHT:
        {
            QSpinBox* spinBox = new QSpinBox(parent);
            spinBox->setSingleStep(1);
//             connect(spinBox, SIGNAL(editingFinished()),
//                 this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
            return spinBox;
        }

    default:
        {
            return QStyledItemDelegate::createEditor(parent, option, index);
        }
    }
}
Example #11
0
QWidget* Sis3350UI::createTriggerGateControls()
{
    // Trigger Gate spinners
    QWidget *box = new QWidget(this);
    QSignalMapper *mapper = new QSignalMapper();
    QHBoxLayout *l = new QHBoxLayout();
    l->setMargin(0);

    gates = new QList<QSpinBox*>();
    QLabel *label = new QLabel(tr("Gap width:"),this);

    l->addWidget(label);

    for(int i=0; i<4; i++)
    {
        QSpinBox *gate = new QSpinBox(this);
        gate->setMinimum(0);
        gate->setMaximum(0x1F);
        gate->setAccelerated(true);
        gate->setSingleStep(1);
        gate->setValue(module->conf.trigger_gap_length[i]);
        gates->append(gate);
        connect(gate,SIGNAL(valueChanged(int)),mapper,SLOT(map()));
        mapper->setMapping(gate,i);
        l->addWidget(gate);
    }
    connect(mapper,SIGNAL(mapped(int)),this,SLOT(gateChanged(int)));
    box->setLayout(l);
    return box;
}
Example #12
0
//! [1]
void Window::createSpinBoxes()
{
    spinBoxesGroup = new QGroupBox(tr("Spinboxes"));

    QLabel *integerLabel = new QLabel(tr("Enter a value between "
        "%1 and %2:").arg(-20).arg(20));
    QSpinBox *integerSpinBox = new QSpinBox;
    integerSpinBox->setRange(-20, 20);
    integerSpinBox->setSingleStep(1);
    integerSpinBox->setValue(0);
//! [1]

//! [2]
    QLabel *zoomLabel = new QLabel(tr("Enter a zoom value between "
        "%1 and %2:").arg(0).arg(1000));
//! [3]
    QSpinBox *zoomSpinBox = new QSpinBox;
    zoomSpinBox->setRange(0, 1000);
    zoomSpinBox->setSingleStep(10);
    zoomSpinBox->setSuffix("%");
    zoomSpinBox->setSpecialValueText(tr("Automatic"));
    zoomSpinBox->setValue(100);
//! [2] //! [3]

//! [4]
    QLabel *priceLabel = new QLabel(tr("Enter a price between "
        "%1 and %2:").arg(0).arg(999));
    QSpinBox *priceSpinBox = new QSpinBox;
    priceSpinBox->setRange(0, 999);
    priceSpinBox->setSingleStep(1);
    priceSpinBox->setPrefix("$");
    priceSpinBox->setValue(99);
//! [4] //! [5]

    QVBoxLayout *spinBoxLayout = new QVBoxLayout;
    spinBoxLayout->addWidget(integerLabel);
    spinBoxLayout->addWidget(integerSpinBox);
    spinBoxLayout->addWidget(zoomLabel);
    spinBoxLayout->addWidget(zoomSpinBox);
    spinBoxLayout->addWidget(priceLabel);
    spinBoxLayout->addWidget(priceSpinBox);
    spinBoxesGroup->setLayout(spinBoxLayout);
}
Example #13
0
QWidget *
pcl::modeler::IntParameter::createEditor(QWidget *parent)
{
  QSpinBox *editor = new QSpinBox(parent);
  editor->setMinimum(low_);
  editor->setMaximum(high_);
  editor->setSingleStep(step_);

  return editor;
}
Example #14
0
QSpinBox *ListerDialog::makeSpinBox(int minimum, int maximum, int singleStep)
{
    QSpinBox *ret = new QSpinBox;

    ret->setMinimum(minimum);
    ret->setMaximum(maximum);
    ret->setSingleStep(singleStep);

    return ret;
}
QWidget *
CQPropertyIntegerEditor::
createEdit(QWidget *parent)
{
  QSpinBox *spin = new QSpinBox(parent);

  spin->setRange(min_, max_);
  spin->setSingleStep(step_);

  return spin;
}
Example #16
0
void UiVariables::newOffsetDial(GLWidget* gl)
{
    QSpinBox* offsetDial = new QSpinBox();
    offsetDial->setMinimum(-40000000);
    offsetDial->setMaximum(40000000);
    offsetDial->setValue(0);
    offsetDial->setSingleStep(1);
    offsets[gl] = offsetDial;

    connect(offsetDial, SIGNAL(editingFinished()), this, SIGNAL(internalsUpdated()));
}
Example #17
0
QWidget *dSettingWindow::createWidget()
{
    QWidget * widget =  new QWidget();
    
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(1);
    layout->setSpacing(5);
    layout->addWidget( new QLabel("Непрозрачноть окна (заначения от 0 до 100).<br>Прозрачные окна имеют проблемы с прорисовкой!") ); 

        QSpinBox *opacitySpinBox = new QSpinBox;
        opacitySpinBox->setRange(30, 100);
        opacitySpinBox->setSingleStep(1);
        opacitySpinBox->setValue(int(window->windowOpacity()*100));
        connect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(opacityValueChanged(int)));
        
        QSlider *opacitySlider = new QSlider(Qt::Horizontal);
        opacitySlider->setFocusPolicy(Qt::StrongFocus);
        opacitySlider->setTickPosition(QSlider::TicksBothSides);
        opacitySlider->setTickInterval(10);
        opacitySlider->setSingleStep(1);
        opacitySlider->setMaximum ( 100 );
        opacitySlider->setMinimum ( 30 );
        opacitySlider->setValue(opacitySpinBox->value());
        connect(opacitySlider, SIGNAL(valueChanged(int)), opacitySpinBox, SLOT(setValue(int)));
        connect(opacitySpinBox, SIGNAL(valueChanged(int)), opacitySlider, SLOT(setValue(int)));
    
        QHBoxLayout *opacityLayout = new QHBoxLayout;
        opacityLayout->setSpacing(15);
        opacityLayout->addWidget( opacitySpinBox );   
        opacityLayout->addWidget( opacitySlider );   
    
    layout->addItem( opacityLayout );   

        layout->addWidget( new QLabel("Изменение рамки окна. Есть возможность использовать стандартное окно,<br> но тогда пропадет эффект \"магнетизма\" окон.") );     
        QHBoxLayout *skinLayout = new QHBoxLayout;
        skinLayout->setSpacing(15);
        skinPushButton = new QPushButton(tr("Load skin"));
        skinPushButton->setDefault(true);
        skinPushButton->setIcon(QIcon(tr("pic/open32x32.png")));
        connect(skinPushButton, SIGNAL(clicked(bool)), this, SLOT(clickedSkinButton(bool)));
        skinLayout->addWidget( skinPushButton );
    
    
        QCheckBox *standartFrameCheckBox = new QCheckBox(tr("Стандартная рамка окна"));    
        connect(standartFrameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
        skinLayout->addWidget( standartFrameCheckBox );
        skinLayout->addStretch ( 1 );

    layout->addItem(skinLayout);

    widget->setLayout(layout); 

    return widget; 
};
void QtSpinBoxFactory::slotSingleStepChanged(QtProperty *property, int step)
{
    if (!m_createdEditors.contains(property))
        return;
    QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
    while (itEditor.hasNext()) {
        QSpinBox *editor = itEditor.next();
        editor->blockSignals(true);
        editor->setSingleStep(step);
        editor->blockSignals(false);
    }
}
Example #19
0
void EvIntDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    QSpinBox * spinBox = qobject_cast<QSpinBox*>(editor);
    EvProperty * p = property(index);

    if(p->hasAttribute("min"))
        spinBox->setMinimum(p->attribute("min").toInt());
    else
        spinBox->setMinimum(std::numeric_limits<int>::min());

    if(p->hasAttribute("max"))
        spinBox->setMaximum(p->attribute("max").toInt());
    else
        spinBox->setMaximum(std::numeric_limits<int>::max());

    if(p->hasAttribute("step"))
        spinBox->setSingleStep(p->attribute("step").toInt());
    else
        spinBox->setSingleStep(1);

    spinBox->setValue(p->value().toInt());
}
QWidget *OBSPropertiesView::AddInt(obs_property_t prop)
{
	const char *name = obs_property_name(prop);
	int        val   = (int)obs_data_getint(settings, name);
	QSpinBox   *spin = new QSpinBox();

	spin->setMinimum(obs_property_int_min(prop));
	spin->setMaximum(obs_property_int_max(prop));
	spin->setSingleStep(obs_property_int_step(prop));
	spin->setValue(val);

	return NewWidget(prop, spin, SIGNAL(valueChanged(int)));
}
	QWidget* createWidgets(BasePropertyWidget* parent)
	{
		m_spinBox = new QSpinBox(parent);
		m_spinBox->setMinimum(INT_MIN);
		m_spinBox->setMaximum(INT_MAX);
		m_spinBox->setSingleStep(1);
		m_spinBox->setEnabled(!parent->readOnly());

		void(QSpinBox::*valueChanged)(int) = &QSpinBox::valueChanged; // Get the right overload
		QObject::connect(m_spinBox, valueChanged, parent, &BasePropertyWidget::setWidgetDirty);

		return m_spinBox;
	}
Example #22
0
File: window.cpp Project: mtao/MSc
void LevelSetRangeViewer::createControls()
{
    if(control)
        delete control;
    control = new QWidget(this, Qt::Tool);
    QVBoxLayout * layout = new QVBoxLayout;
    control->setLayout(layout);
    control->show();


    QPushButton *colorButton = new QPushButton(tr("Choose model color"));
    connect(colorButton, SIGNAL(clicked()), m_widget, SLOT(setModelColor()));
    control->layout()->addWidget(colorButton);

    QSlider * scaleSlider = new QSlider();
    connect(scaleSlider, SIGNAL(valueChanged(int)), m_widget, SLOT(changeScale(int)));
    control->layout()->addWidget(scaleSlider);


    QCheckBox * culling = new QCheckBox(tr("Backface Culling"));
    QObject::connect(culling, SIGNAL(toggled(bool)), m_widget, SLOT(backfaceCulling(bool)));
    QObject::connect(m_widget, SIGNAL(setBackfaceCulling(bool)), culling, SLOT(setChecked(bool)));
    control->layout()->addWidget(culling);
    culling->setChecked(true);

    QSpinBox * isoMinSlider = new QSpinBox();
    isoMinSlider->setMinimum(0);
    isoMinSlider->setMaximum(255);
    isoMinSlider->setSingleStep(1);
    connect(isoMinSlider, SIGNAL(valueChanged(int)), m_widget, SLOT(isoChangeMin(int)));
    control->layout()->addWidget(isoMinSlider);
    QSpinBox * isoMaxSlider = new QSpinBox();
    isoMaxSlider->setMinimum(0);
    isoMaxSlider->setMaximum(255);
    isoMaxSlider->setSingleStep(1);
    connect(isoMaxSlider, SIGNAL(valueChanged(int)), m_widget, SLOT(isoChangeMax(int)));
    control->layout()->addWidget(isoMaxSlider);
}
/*!
    \internal

    Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtSpinBoxFactory::createEditor(QtIntPropertyManager *manager, QtProperty *property,
        QWidget *parent)
{
    QSpinBox *editor = this->createEditorImpl(property, parent);
    editor->setSingleStep(manager->singleStep(property));
    editor->setRange(manager->minimum(property), manager->maximum(property));
    editor->setValue(manager->value(property));
    editor->setKeyboardTracking(false);

    connect(editor, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int)));
    connect(editor, SIGNAL(destroyed(QObject*)),
                this, SLOT(slotEditorDestroyed(QObject*)));
    return editor;
}
QWidget *LoanAssumptionDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & index) const {
    if (!index.data(Qt::UserRole).isNull())	{
        switch (index.data(Qt::UserRole).toInt()) {
        case static_cast<qint8>(AssumptionType::DoubleAssumption) : {
            QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
            editor->setMinimum(0.0);
            editor->setSingleStep(5.0);
            //connect(editor, SIGNAL(valueChanged(double)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::DoubleAssumption0To100) : {
            QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
            editor->setMinimum(0.0);
            editor->setSingleStep(5.0);
            editor->setMaximum(100.0);
            editor->setSuffix("%");
            //connect(editor, SIGNAL(valueChanged(double)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::IntegerAssumption) : {
            QSpinBox *editor = new QSpinBox(parent);
            editor->setMinimum(0);
            editor->setSingleStep(1);
            //connect(editor, SIGNAL(valueChanged(int)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::BloombergVectorAssumption) : {
            QLineEdit *editor = new QLineEdit(parent);
            editor->setValidator(BloombergVector().GetValidator(editor));
            //connect(editor, SIGNAL(textEdited(const QString &)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::IntegerVectorAssumption) : {
            QLineEdit *editor = new QLineEdit(parent);
            editor->setValidator(IntegerVector().GetValidator(editor));
            //connect(editor, SIGNAL(textEdited(const QString &)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::DayCountVectorAssumption) : {
            QLineEdit *editor = new QLineEdit(parent);
            editor->setValidator(DayCountVector().GetValidator(editor));
            //connect(editor, SIGNAL(textEdited(const QString &)), this, SIGNAL(Edited()));
            return editor;
        }
        default:
            break;
        }
    }
    return new QWidget(parent);
}
    QtnPropertyIntSpinBoxHandler(QtnPropertyIntBase& property, QSpinBox& editor)
        : QtnPropertyEditorHandlerType(property, editor)
    {
        if (!property.isEditableByUser())
            editor.setReadOnly(true);

        editor.setRange(property.minValue(), property.maxValue());
        editor.setSingleStep(property.stepValue());

        updateEditor();

        QObject::connect(  &editor, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
                         , this, &QtnPropertyIntSpinBoxHandler::onValueChanged);
    }
Example #26
0
QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
                                       const QStyleOptionViewItem &/* option */,
                                       const QModelIndex &/* index */) const
{
    QSpinBox *editor = new QSpinBox(parent);
    editor->setMinimum(0);
    editor->setMaximum(100);
    editor->setSingleStep(10);
    editor->setFrame(false);
    // allow edits to the editor to appear in the main QSpinBox in the GUI
    if (s)
        connect(editor,SIGNAL(valueChanged(int)),s,SLOT(setValue(int)));
    return editor;
}
void PICWeeklySettings::addShock()
{
    QDialog shockDialog;
    QDialogButtonBox* dialogBtn = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &shockDialog);
    QLabel* ratingLabel = new QLabel(&shockDialog);
    ratingLabel->setText(tr("Rating Band"));
    QComboBox* ratingCombo = new QComboBox(&shockDialog);
    for (int i = 2; i < numRatingBands+2; ++i)
        ratingCombo->addItem(m_ShocksModel->headerData(i, Qt::Horizontal).toString());
    QLabel* sectorLabel = new QLabel(&shockDialog);
    sectorLabel->setText(tr("Sector"));
    QComboBox* sectorCombo = new QComboBox(&shockDialog);
    sectorCombo->setModel(sectorDelegate->model());
    QLabel* geogLabel = new QLabel(&shockDialog);
    geogLabel->setText(tr("Country"));
    QComboBox* geogCombo = new QComboBox(&shockDialog);
    geogCombo->setModel(geographyDelegate->model());
    QLabel* shockLabel = new QLabel(&shockDialog);
    shockLabel->setText(tr("Shock (bps)"));
    QSpinBox* shockSpin = new QSpinBox(&shockDialog);
    shockSpin->setRange(0, std::numeric_limits<int>::max());
    shockSpin->setValue(0);
    shockSpin->setSingleStep(1);
    QGridLayout* dialogLay = new QGridLayout(&shockDialog);
    dialogLay->addWidget(ratingLabel, 0, 0);
    dialogLay->addWidget(ratingCombo, 0, 1);
    dialogLay->addWidget(sectorLabel, 1, 0);
    dialogLay->addWidget(sectorCombo, 1, 1);
    dialogLay->addWidget(geogLabel, 2, 0);
    dialogLay->addWidget(geogCombo, 2, 1);
    dialogLay->addWidget(shockLabel, 3, 0);
    dialogLay->addWidget(shockSpin, 3, 1);
    dialogLay->addWidget(dialogBtn, 4, 0, 1, 2);
    connect(dialogBtn, &QDialogButtonBox::accepted, &shockDialog, &QDialog::accept);
    connect(dialogBtn, &QDialogButtonBox::rejected, &shockDialog, &QDialog::reject);
    if(shockDialog.exec()==QDialog::Accepted){
        const QModelIndex currPar=m_Shockview->rootIndex();
        if (!currPar.isValid())
            return;
        addScenarioData(
            currPar.data().toString()
            , geogCombo->currentData().toBool() ? QString(): geogCombo->currentText()
            , sectorCombo->currentData().toBool() ? QString() : sectorCombo->currentText()
            , ratingCombo->currentData().toBool() ? QString() : ratingCombo->currentText()
            , shockSpin->value()
            );
    }
}
Example #28
0
// Create new integer spin widget
QtWidgetObject* AtenTreeGuiDialog::addIntegerSpin(TreeGuiWidget* widget, QString label, int step)
{
	QtWidgetObject* qtwo = widgetObjects_.add();
	QSpinBox *spin = new QSpinBox(this);
	qtwo->set(widget, spin, label);
	spin->setRange(widget->minimumI(), widget->maximumI());
	spin->setValue(widget->valueI());
	spin->setSingleStep(step);
	spin->setEnabled(widget->enabled());
	spin->setVisible(widget->visible());
	spin->setMinimumHeight(WIDGETHEIGHT);
	spin->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	// Connect signal to master slot
	QObject::connect(spin, SIGNAL(valueChanged(int)), this, SLOT(integerSpinWidget_valueChanged(int)));
	return qtwo;
}
Example #29
0
QSpinBox* new_spin_box (QBoxLayout *layout, const QString &label, int min, int max, int value, int step)
{
  QHBoxLayout *lt_h = new QHBoxLayout;
  QLabel *l = new QLabel (label);

  QSpinBox *r = new QSpinBox;

  r->setSingleStep (step);
  r->setRange (min, max);
  r->setValue (value);

  lt_h->addWidget (l);
  lt_h ->addWidget (r);

  layout->addLayout (lt_h);

  return r;
}
Example #30
0
int QtopiaInputDialog::getInteger(QWidget *parent, const QString &title, const QString &label, int value,
                                  int minValue, int maxValue, int step, bool *ok)
{
    QSpinBox *sb = new QSpinBox;
    QFont font(sb->font());
    font.setPointSize(font.pointSize()+3);
    sb->setFont(font);
    sb->setValue(value);
    sb->setMinimum(minValue);
    sb->setMaximum(maxValue);
    sb->setSingleStep(step);

    QtopiaInputDialog dlg(parent, title, label, sb);
    bool accepted = (QtopiaApplication::execDialog(&dlg) == QDialog::Accepted);
    if (ok)
        *ok = accepted;
    return sb->value();
}