void diaElemAspectRatio::setMe(void *dialog, void *opaque, uint32_t line)
{
	QLabel *text = new QLabel(myQtTitle);
	QSpinBox *numBox = new QSpinBox();
	QLabel *label = new QLabel(":");
	QSpinBox *denBox = new QSpinBox();
	QGridLayout *layout = (QGridLayout*) opaque;
	QHBoxLayout *hboxLayout = new QHBoxLayout();

	myWidget = (void*)numBox;
	this->label = (void*)label;
	this->denControl = (void*)denBox;

	text->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	text->setBuddy(numBox);

	numBox->setMinimum(1);
	numBox->setMaximum(255);

	denBox->setMinimum(1);
	denBox->setMaximum(255);

	numBox->setValue(*(uint32_t*)param);
	denBox->setValue(*(uint32_t*)den);

	QSpacerItem *spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

	hboxLayout->addWidget(numBox);
	hboxLayout->addWidget(label);
	hboxLayout->addWidget(denBox);
	hboxLayout->addItem(spacer);

	layout->addWidget(text,line,0);
	layout->addLayout(hboxLayout,line,1);
}
Example #2
0
QList<QWidget *> Object::getControls()
{
    QSpinBox *bonus = new QSpinBox();
    bonus->setObjectName("bonus");    
    bonus->setMaximum(1000);
    bonus->setValue(_bonus);
    connect(bonus,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_bonus = new Control("Bonificación de armadura", bonus);

    QSpinBox *time = new QSpinBox();
    time->setSuffix(" seg");
    time->setObjectName("time");
    time->setMinimum(1);
    time->setMaximum(1000);
    time->setValue(_time);
    connect(time,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_time = new Control("Tiempo de efecto", time);

    QSpinBox *cooldown = new QSpinBox();
    cooldown->setSuffix(" seg");
    cooldown->setObjectName("cooldown");
    cooldown->setMinimum(1);
    cooldown->setMaximum(1000);
    cooldown->setValue(_cooldown);
    connect(cooldown,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_cooldown = new Control("Tiempo de reaparición", cooldown);

    QList<QWidget*> controls = IObject::getControls();
    controls.append(c_bonus);
    controls.append(c_time);
    controls.append(c_cooldown);

    return controls;
}
Example #3
0
TimelinePage::TimelinePage(QWidget* parent) : QWidget(parent)
{
    QSettings settings("Pencil","Pencil");

    QVBoxLayout* lay = new QVBoxLayout();

    QGroupBox* timeLineBox = new QGroupBox(tr("Timeline"));
    QCheckBox* drawLabel = new QCheckBox(tr("Draw timeline labels"));    
    QSpinBox* fontSize = new QSpinBox();
    QLabel* frameSizeLabel = new QLabel(tr("Frame size in Pixels"));
    QSpinBox* frameSize = new QSpinBox(this);
    QLabel* lengthSizeLabel = new QLabel(tr("Timeline size in Frames"));
    QLineEdit* lengthSize = new QLineEdit(this);
    lengthSize->setInputMask("0009");

    QCheckBox* scrubBox = new QCheckBox(tr("Short scrub"));
    scrubBox->setChecked(false); // default
    if (settings.value("shortScrub").toBool()) scrubBox->setChecked(true);

    fontSize->setMinimum(4);
    fontSize->setMaximum(20);
    frameSize->setMinimum(4);
    frameSize->setMaximum(20);

    fontSize->setFixedWidth(50);
    frameSize->setFixedWidth(50);
    lengthSize->setFixedWidth(50);

    if (settings.value("drawLabel")=="false") drawLabel->setChecked(false);
    else drawLabel->setChecked(true);
    fontSize->setValue(settings.value("labelFontSize").toInt());
    frameSize->setValue(settings.value("frameSize").toInt());
    if (settings.value("labelFontSize").toInt()==0) fontSize->setValue(12);
    if (settings.value("frameSize").toInt()==0) frameSize->setValue(6);
    lengthSize->setText(settings.value("length").toString());
    if (settings.value("length").toInt()==0) lengthSize->setText("240");

    connect(fontSize, SIGNAL(valueChanged(int)), parent, SIGNAL(fontSizeChange(int)));
    connect(frameSize, SIGNAL(valueChanged(int)), parent, SIGNAL(frameSizeChange(int)));
    connect(lengthSize, SIGNAL(textChanged(QString)), parent, SIGNAL(lengthSizeChange(QString)));
    connect(drawLabel, SIGNAL(stateChanged(int)), parent, SIGNAL(labelChange(int)));
    connect(scrubBox, SIGNAL(stateChanged(int)), parent, SIGNAL(scrubChange(int)));

    //lay->addWidget(drawLabel);
    //lay->addWidget(fontSizeLabel);
    //lay->addWidget(fontSize);
    lay->addWidget(frameSizeLabel);
    lay->addWidget(frameSize);
    lay->addWidget(lengthSizeLabel);
    lay->addWidget(lengthSize);
    lay->addWidget(scrubBox);
    timeLineBox->setLayout(lay);

    QVBoxLayout* lay2 = new QVBoxLayout();
    lay2->addWidget(timeLineBox);
    lay2->addStretch(1);
    setLayout(lay2);
}
Example #4
0
ToolsPage::ToolsPage(QWidget* parent) : QWidget(parent)
{
    QSettings settings("Pencil","Pencil");

    QVBoxLayout* lay = new QVBoxLayout();

    QGroupBox* onionSkinBox = new QGroupBox(tr("Onion skin"));
    
    QLabel* onionMaxOpacityLabel = new QLabel(tr("Maximum onion opacity %"));
    QSpinBox* onionMaxOpacityBox = new QSpinBox();
    QLabel* onionMinOpacityLabel = new QLabel(tr("Minimum onion opacity %"));
    QSpinBox* onionMinOpacityBox = new QSpinBox();
    QLabel* onionPrevFramesNumLabel = new QLabel(tr("Number of previous onion frames shown"));
    QSpinBox* onionPrevFramesNumBox = new QSpinBox();
    QLabel* onionNextFramesNumLabel = new QLabel(tr("Number of next onion frames shown"));
    QSpinBox* onionNextFramesNumBox = new QSpinBox();

    onionMaxOpacityBox->setMinimum(0);
    onionMaxOpacityBox->setMaximum(100);
    onionMaxOpacityBox->setFixedWidth(50);
    onionMinOpacityBox->setMinimum(0);
    onionMinOpacityBox->setMaximum(100);
    onionMinOpacityBox->setFixedWidth(50);
    onionPrevFramesNumBox->setMinimum(1);
    onionPrevFramesNumBox->setMaximum(60);
    onionPrevFramesNumBox->setFixedWidth(50);
    onionNextFramesNumBox->setMinimum(1);
    onionNextFramesNumBox->setMaximum(60);
    onionNextFramesNumBox->setFixedWidth(50);

    onionMaxOpacityBox->setValue(settings.value( SETTING_ONION_MAX_OPACITY ).toInt());
    onionMinOpacityBox->setValue(settings.value( SETTING_ONION_MIN_OPACITY ).toInt());
    onionPrevFramesNumBox->setValue(settings.value( SETTING_ONION_PREV_FRAMES_NUM).toInt());
    onionNextFramesNumBox->setValue(settings.value( SETTING_ONION_NEXT_FRAMES_NUM ).toInt());

    connect(onionMaxOpacityBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionMaxOpacityChange(int)));
    connect(onionMinOpacityBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionMinOpacityChange(int)));
    connect(onionPrevFramesNumBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionPrevFramesNumChange(int)));
    connect(onionNextFramesNumBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionNextFramesNumChange(int)));

    lay->addWidget(onionMaxOpacityLabel);
    lay->addWidget(onionMaxOpacityBox);
    lay->addWidget(onionMinOpacityLabel);
    lay->addWidget(onionMinOpacityBox);
    lay->addWidget(onionPrevFramesNumLabel);
    lay->addWidget(onionPrevFramesNumBox);
    lay->addWidget(onionNextFramesNumLabel);
    lay->addWidget(onionNextFramesNumBox);
    onionSkinBox->setLayout(lay);

    QVBoxLayout* lay2 = new QVBoxLayout();
    lay2->addWidget(onionSkinBox);
    lay2->addStretch(1);
    setLayout(lay2);
}
Example #5
0
PhotoTimerDialog::PhotoTimerDialog( QWidget* parent, Qt::WFlags f )
:   QDialog( parent, f ),
    mTimeout( 5 ),
    mNumber( 1 ),
    mInterval( 1 ),
    mIntervalSpin( 0 )
{
    setWindowTitle( tr( "Photo Timer" ) );
    setModal( true);

    QGridLayout* layout = new QGridLayout( this );

    // Add labels
    layout->addWidget( new QLabel( tr( "Timeout" ) ), 0, 0 );
    QSpinBox* timeout = new CameraMinSecSpinBox( this );
    timeout->setMinimum( 1 );
    timeout->setMaximum( 120 );
    timeout->setValue( mTimeout );
    layout->addWidget( timeout, 0, 1 );
    connect( timeout,
             SIGNAL(valueChanged(int)),
             this,
             SLOT(timeoutChanged(int)) );

    layout->addWidget( new QLabel( tr( "Photos" ) ), 1, 0 );
    QSpinBox* number = new NoEditSpinBox(this);
    number->setMinimum( 1 );
    number->setMaximum( 50 );
    number->setValue( mNumber );
    layout->addWidget( number, 1, 1 );
    connect( number,
             SIGNAL(valueChanged(int)),
             this,
             SLOT(numberChanged(int)) );

    layout->addWidget( new QLabel( tr( "Interval" ) ), 2, 0 );
    mIntervalSpin = new CameraMinSecSpinBox( this );
    mIntervalSpin->setMinimum( 1 );
    mIntervalSpin->setMaximum( 120 );
    mIntervalSpin->setValue( mInterval );
    mIntervalSpin->setEnabled( false );
    layout->addWidget( mIntervalSpin, 2, 1 );
    connect( mIntervalSpin,
             SIGNAL(valueChanged(int)),
             this,
             SLOT(intervalChanged(int)) );

    setLayout( layout );
    
    QtopiaApplication::setInputMethodHint(timeout,QtopiaApplication::AlwaysOff);
    QtopiaApplication::setInputMethodHint(number,QtopiaApplication::AlwaysOff);
    QtopiaApplication::setInputMethodHint(mIntervalSpin,QtopiaApplication::AlwaysOff);

}
Example #6
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QWidget *USplata_zaborg_Delegate::createEditor(QWidget *parent,
        const QStyleOptionViewItem &option,
        const QModelIndex &index) const
{
	QSpinBox *spinbox;
    if (index.column() == durationColumn_1) {
        spinbox = new QSpinBox(parent);
        spinbox->setMaximum ( 999999 );
		spinbox->setMinimum ( 1 );
        connect(spinbox, SIGNAL(editingFinished()),
                this, SLOT(commitAndCloseEditor()));
        return spinbox;
    }
	else if (index.column() == durationColumn_2){
        QDoubleSpinBox *double_spinbox = new QDoubleSpinBox(parent);
        double_spinbox->setMaximum ( 99999 );
		double_spinbox->setMinimum ( 1 );
        connect(double_spinbox, SIGNAL(editingFinished()),
                this, SLOT(commitAndCloseEditor()));
        return double_spinbox;
    }
	else if ((index.column() == durationColumn_3) || (index.column() == durationColumn_5)) {
        spinbox = new QSpinBox(parent);
        spinbox->setMaximum ( 12 );
		spinbox->setMinimum ( 1 );
        connect(spinbox, SIGNAL(editingFinished()),
                this, SLOT(commitAndCloseEditor()));
        return spinbox;
    }
	else if ((index.column() == durationColumn_4) || (index.column() == durationColumn_6)) {
        spinbox = new QSpinBox(parent);
        spinbox->setMaximum ( 2100 );
		spinbox->setMinimum ( 2004 );
        connect(spinbox, SIGNAL(editingFinished()),
                this, SLOT(commitAndCloseEditor()));
        return spinbox;
    }
    else if (index.column() == durationColumn_7) {
        QSpinBox *spinbox = new QSpinBox(parent);
        spinbox->setMaximum ( 999999 );
		spinbox->setMinimum ( 1 );
        connect(spinbox, SIGNAL(editingFinished()),
                this, SLOT(commitAndCloseEditor()));
        return spinbox;
    }
	else{
        return QSqlRelationalDelegate::createEditor(parent, option, index);
    }
}
LifeControlsWidget::LifeControlsWidget(SimOptions *opts, SimController *ctrlr, LifeScrollWidget &scroll) : displayWidget(scroll)  {
	options = opts;
	controller = ctrlr;
	delay = 100;
	play = false;

	QLabel *gridLabel = new QLabel("Grid Size:");
	QLabel *delayLabel = new QLabel("Delay:");
	genLabel = new QLabel("Generation:\t 1");
	refreshGenLabel();

	QSpinBox *gridSizeSpin = new QSpinBox();
	gridSizeSpin->setMinimum(1);
	gridSizeSpin->setMaximum(1000);
	gridSizeSpin->setValue(opts->getBlockSize());

	QSpinBox *delaySpin = new QSpinBox();
	delaySpin->setMinimum(10);
	delaySpin->setMaximum(10000);
	delaySpin->setValue(delay);
	
	QPushButton *quitBtn = new QPushButton("Quit");
	QPushButton *restartBtn = new QPushButton("Restart");
	playBtn = new QPushButton("Play");
	QPushButton *stepBtn = new QPushButton("Step");
	
	QBoxLayout *box = new QBoxLayout(QBoxLayout::TopToBottom, this);
	
	box->addWidget(gridLabel);
	box->addWidget(gridSizeSpin);
	box->addWidget(delayLabel);
	box->addWidget(delaySpin);
	box->addWidget(genLabel);
	box->addWidget(quitBtn);
	box->addWidget(restartBtn);
	box->addWidget(playBtn);
	box->addWidget(stepBtn);
	box->addStretch(1);
	box->addSpacing(12);
	setLayout(box);

	connect(quitBtn, SIGNAL(clicked()), this, SLOT(onQuit()));
	connect(restartBtn, SIGNAL(clicked()), this, SLOT(onRestart()));
	connect(playBtn, SIGNAL(clicked()), this, SLOT(onPlay()));
	connect(stepBtn, SIGNAL(clicked()), this, SLOT(onStep()));
	connect(gridSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(onSizeChange(int)));
	connect(delaySpin, SIGNAL(valueChanged(int)), this, SLOT(onDelayChange(int)));
}
QWidget *reDefaultItemEditorFactory::createEditor(QVariant::Type type, QWidget *parent) const
{
	switch (type) {
	case QVariant::Bool: {
		QBooleanComboBox *cb = new QBooleanComboBox(parent);
		return cb; }
	case QVariant::UInt: {
		QSpinBox *sb = new QSpinBox(parent);
		sb->setFrame(false);
		sb->setMaximum(INT_MAX);
		return sb; }
	case QVariant::Int: {
		QSpinBox *sb = new QSpinBox(parent);
		sb->setFrame(false);
		sb->setMinimum(INT_MIN);
		sb->setMaximum(INT_MAX);
		return sb; }
	case QVariant::Date: {
		QDateTimeEdit *ed = new QDateEdit(parent);
		ed->setFrame(false);
		return ed; }
	case QVariant::Time: {
		QDateTimeEdit *ed = new QTimeEdit(parent);
		ed->setFrame(false);
		return ed; }
	case QVariant::DateTime: {
		QDateTimeEdit *ed = new QDateTimeEdit(parent);
		ed->setFrame(false);
		return ed; }
	case QVariant::Pixmap:
		return new QLabel(parent);
	case QVariant::Double: {
		QDoubleSpinBox *sb = new QDoubleSpinBox(parent);
		sb->setFrame(false);
		sb->setMinimum(-DBL_MAX);
		sb->setMaximum(DBL_MAX);
		return sb; }
	case QVariant::String:
	default: {
		// the default editor is a lineedit
		QLineEdit *le = new QLineEdit(parent);
		//le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le));
		//if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, le))
			//le->setWidgetOwnsGeometry(true);
		return le; }
	}
	return 0;
}
// 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 #10
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 #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
QWidget * PrefsDialog::createAutosaveForm() {
	QGroupBox * autosave = new QGroupBox(tr("Autosave"), this );

	QHBoxLayout * zhlayout = new QHBoxLayout();
	zhlayout->setSpacing(SPACING);

	QCheckBox * box = new QCheckBox(tr("Autosave every:"));
	box->setChecked(MainWindow::AutosaveEnabled);
	zhlayout->addWidget(box);

	zhlayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding));

	QSpinBox * spinBox = new QSpinBox;
	spinBox->setMinimum(1);
	spinBox->setMaximum(60);
	spinBox->setValue(MainWindow::AutosaveTimeoutMinutes);
	spinBox->setMaximumWidth(80);
	zhlayout->addWidget(spinBox);

	QLabel * label = new QLabel(tr("minutes"));
	zhlayout->addWidget(label);

	autosave->setLayout(zhlayout);

	connect(box, SIGNAL(clicked(bool)), this, SLOT(toggleAutosave(bool)));
	connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(changeAutosavePeriod(int)));


	return autosave;
}
Example #13
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 #14
0
QWidget* Sis3350UI::createInputGainControls()
{
    // Gain spinners
    QWidget *box = new QWidget(this);
    QSignalMapper *mapper = new QSignalMapper();
    QHBoxLayout *l = new QHBoxLayout();
    l->setMargin(0);

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

    l->addWidget(label);

    for(int i=0; i<4; i++)
    {
        QSpinBox *gain = new QSpinBox(this);
        gain->setMinimum(0);
        gain->setMaximum(255);
        gain->setValue(module->conf.variable_gain[i]);
        gains->append(gain);
        connect(gain,SIGNAL(valueChanged(int)),mapper,SLOT(map()));
        mapper->setMapping(gain,i);
        l->addWidget(gain);
    }
    connect(mapper,SIGNAL(mapped(int)),this,SLOT(gainChanged(int)));
    box->setLayout(l);
    return box;
}
Example #15
0
QWidget *EventDelegate::createEditor(QWidget *parent,
     const QStyleOptionViewItem &/* option */,
     const QModelIndex & index) const
{
    const EventModel* pEventModel = static_cast<const EventModel*>(index.model());

    switch(index.column()) {
        case 0: {
            QSpinBox *editor = new QSpinBox(parent);
            editor->setMinimum(0);
            editor->setMaximum(pEventModel->getFirstLastSample().second);
            return editor;
        }

        case 1: {
            QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
            editor->setMinimum(0.0);
            editor->setMaximum(pEventModel->getFirstLastSample().second / pEventModel->getFiffInfo()->sfreq);
            editor->setSingleStep(0.01);
            return editor;
        }

        case 2: {
            QComboBox *editor = new QComboBox(parent);
            editor->addItems(pEventModel->getEventTypeList());
            return editor;
        }
    }

    QWidget *returnWidget = new QWidget();
    return returnWidget;
}
Example #16
0
QWidget *CQSpinBoxDelegate::createEditor(QWidget *parent,
    const QStyleOptionViewItem & C_UNUSED(option),
    const QModelIndex & index) const
{
  QSpinBox *editor = new QSpinBox(parent);
  editor->setMinimum(1);
  unsigned C_INT32 max = 1;

  const QSortFilterProxyModel *pProxyDM = dynamic_cast<const QSortFilterProxyModel *>(index.model());
  QModelIndex BDMIndex;
  const CQBaseDataModel *pBDM;

  if (pProxyDM)
    {
      pBDM = dynamic_cast<const CQBaseDataModel *>(pProxyDM->sourceModel());
      BDMIndex = pProxyDM->mapToSource(index);
    }
  else
    {
      pBDM = dynamic_cast<const CQBaseDataModel *>(index.model());
      BDMIndex = index;
    }

  if (pBDM)
    {
      if (pBDM->isDefaultRow(BDMIndex))
        max = pBDM->rowCount();
      else
        max = pBDM->rowCount() - 1;
    }

  editor->setMaximum(max);
  return editor;
}
/*!\func IDelegate::createEditor
 * создает редактор ячейки
 * \param нет
 * \return нет
 */
QWidget *IDelegate::createEditor(QWidget *parent,
     const QStyleOptionViewItem &/* option */,
     const QModelIndex & index) const
{
    LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
    switch(index.column()) {
        case 0:
        {
            IdentificatorEdit *editor = new IdentificatorEdit(parent);
            //editor->setInputMask("NNNNNNNNNNNNNNN");
            return editor;
        }
        case 1:
        {
            QSpinBox *editor = new QSpinBox(parent);
            editor->setMinimum(1);
            editor->setMaximum(100);
            return editor;
        }
        case 2:
        {
            return 0;
            QComboBox *editor = new QComboBox(parent);
            editor->addItem("wire");
            editor->addItem("reg");
            return editor;
        }
    }
    return 0;
}
Example #18
0
void MainWindow::addSpinBoxes(bool checked, int count, Range range)
{
    if (checked) {
        QWidget *w = new QWidget(ui->quantifierValuesGroupBox);
        if (ui->quantifierValuesGroupBox->layout() == 0) {
            QHBoxLayout *hbl = new QHBoxLayout(ui->quantifierValuesGroupBox);
            ui->quantifierValuesGroupBox->setLayout(hbl);
        }
        ui->quantifierValuesGroupBox->layout()->addWidget(w);
        QFormLayout *fl = new QFormLayout(w);
        for (int i = 0; i < count; i++) {
            QAbstractSpinBox *asb;
            if (range == Absolute) {
                QSpinBox *sb = new QSpinBox(w);
                sb->setMinimum(0);
                sb->setMaximum(10000);
                asb = sb;
            } else {
                QDoubleSpinBox *sb = new QDoubleSpinBox(w);
                sb->setMinimum(0);
                sb->setMaximum(1);
                sb->setSingleStep(0.05);
                asb = sb;
            }
            fl->addRow(QString(QChar('A' + i)), asb);
        }
    } else {
        QLayout *fl = ui->quantifierValuesGroupBox->layout();
        if (fl != nullptr && fl->count() > 0) {
            QWidget *w = fl->takeAt(0)->widget();
            delete w;
            // there is no mem-leak here, qt handles qobject's children by itself
        }
    }
}
 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &/*index*/ ) const
 {
   QSpinBox *editor = new QSpinBox( parent );
   editor->setMinimum( 0 );
   editor->setMaximum( 999 );
   return editor;
 }
Example #20
0
FilesPage::FilesPage(QWidget* parent) : QWidget(parent)
{
    QSettings settings("Pencil","Pencil");

    QVBoxLayout* lay = new QVBoxLayout();

    QGroupBox* autosaveBox = new QGroupBox(tr("Autosave documents"));
    QCheckBox* autosaveCheckBox = new QCheckBox(tr("Enable autosave"));
    QLabel* autosaveNumberLabel = new QLabel(tr("Number of modifications before autosaving:"));
    QSpinBox* autosaveNumberBox = new QSpinBox();

    autosaveNumberBox->setMinimum(5);
    autosaveNumberBox->setMaximum(200);
    autosaveNumberBox->setFixedWidth(50);

    autosaveCheckBox->setChecked(false);
    if (settings.value("autosave")=="true") autosaveCheckBox->setChecked(true);

    autosaveNumberBox->setValue(settings.value("autosaveNumber").toInt());
    if (settings.value("autosaveNumber").toInt()==0) autosaveNumberBox->setValue(20);

    connect(autosaveNumberBox, SIGNAL(valueChanged(int)), parent, SIGNAL(autosaveNumberChange(int)));
    connect(autosaveCheckBox, SIGNAL(stateChanged(int)), parent, SIGNAL(autosaveChange(int)));

    lay->addWidget(autosaveCheckBox);
    lay->addWidget(autosaveNumberLabel);
    lay->addWidget(autosaveNumberBox);
    autosaveBox->setLayout(lay);

    QVBoxLayout* lay2 = new QVBoxLayout();
    lay2->addWidget(autosaveBox);
    lay2->addStretch(1);
    setLayout(lay2);
}
Example #21
0
QWidget* EPItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QSpinBox* editor = new QSpinBox(parent);
    editor->setMinimum(0);
    editor->setMaximum(100);
    return editor;
}
QWidget *StatusDelegate::createEditor(QWidget *AParent, const QStyleOptionViewItem &AOption, const QModelIndex &AIndex) const
{
	switch (AIndex.data(STR_COLUMN).toInt())
	{
	case STC_STATUS:
		{
			QComboBox *comboBox = new QComboBox(AParent);
			comboBox->addItem(FStatusChanger->iconByShow(IPresence::Online),FStatusChanger->nameByShow(IPresence::Online),IPresence::Online);
			comboBox->addItem(FStatusChanger->iconByShow(IPresence::Chat),FStatusChanger->nameByShow(IPresence::Chat),IPresence::Chat);
			comboBox->addItem(FStatusChanger->iconByShow(IPresence::Away),FStatusChanger->nameByShow(IPresence::Away),IPresence::Away);
			comboBox->addItem(FStatusChanger->iconByShow(IPresence::DoNotDisturb),FStatusChanger->nameByShow(IPresence::DoNotDisturb),IPresence::DoNotDisturb);
			comboBox->addItem(FStatusChanger->iconByShow(IPresence::ExtendedAway),FStatusChanger->nameByShow(IPresence::ExtendedAway),IPresence::ExtendedAway);
			comboBox->addItem(FStatusChanger->iconByShow(IPresence::Invisible),FStatusChanger->nameByShow(IPresence::Invisible),IPresence::Invisible);
			comboBox->addItem(FStatusChanger->iconByShow(IPresence::Offline),FStatusChanger->nameByShow(IPresence::Offline),IPresence::Offline);
			comboBox->setEditable(false);
			return comboBox;
		}
	case STC_PRIORITY:
		{
			QSpinBox *spinBox = new QSpinBox(AParent);
			spinBox->setMinimum(-128);
			spinBox->setMaximum(128);
			return spinBox;
		}
	default:
		return QStyledItemDelegate::createEditor(AParent,AOption,AIndex);
	}
}
/**
 * @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 #24
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 #25
0
QWidget * SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */, const QModelIndex & /* index */ ) const
{
    QSpinBox *editor = new QSpinBox(parent);
    editor->setFrame(false);
    editor->setMinimum(0);
    editor->setMaximum(10000);
    return editor;
}
void ParallelGuiMpiLauncher::addNode()
{
   NodesTableWidget->insertRow(NodesTableWidget->rowCount());
   QSpinBox *fNodes = new QSpinBox;
   fNodes->setMinimum(1);
   fNodes->setMaximum(255);
   NodesTableWidget->setCellWidget(NodesTableWidget->rowCount() - 1, 1, fNodes);
}
Example #27
0
QSpinBox * PaletteEditor::create_color_spinbox()
{
    QSpinBox * box = new QSpinBox(this);
    box->setMinimum(0);
    box->setMaximum(255);
    connect(box, SIGNAL(valueChanged(int)), this, SLOT(rgb_changed()));
    return box;
}
QWidget *SpinBoxDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */ ) const
{
    QSpinBox *editor = new QSpinBox( parent );
    editor->setMinimum( 1 );
    editor->setMaximum( 999 );
    editor->setSuffix( "min" );

    return editor;
}
QWidget* DashLabel::getSettingsWidget(int setting){
    QToolButton* btn;
    QLineEdit *line;
    QSpinBox *spin;
    switch(setting){
        case 0:
            line = new QLineEdit;
            line->setObjectName("Nome");
            line->setText(item->text(0));
            line->setMaxLength(14);
            connect(line, SIGNAL(textChanged(QString)), this, SLOT(setName(QString)));
            return line;
        case 2:
            spin = new QSpinBox;
            spin->setObjectName("X");
            spin->setMinimum(0);
            spin->setMaximum(1920);
            spin->setValue(x);
            connect(spin, SIGNAL(valueChanged(int)), this, SLOT(setX(int)));
            return spin;
        case 3:
            spin = new QSpinBox;
            spin->setObjectName("Y");
            spin->setMinimum(0);
            spin->setMaximum(1920);
            spin->setValue(y);
            connect(spin, SIGNAL(valueChanged(int)), this, SLOT(setY(int)));
            return spin;
        case 4:
            line = new QLineEdit;
            line->setObjectName("Testo");
            line->setText(text);
            connect(line, SIGNAL(textChanged(QString)), this, SLOT(setText(QString)));
            return line;
        case 5:
            btn = new QToolButton;
            btn->setObjectName("Font");
            btn->setText("...");
            connect(btn, SIGNAL(clicked()), this, SLOT(setFont()));
            return btn;
        default:
            return DashWidget::getSettingsWidget(setting);
    }
}
QWidget *BrainTreeDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option , const QModelIndex& index) const
{
    const BrainTreeModel* pBrainTreeModel = static_cast<const BrainTreeModel*>(index.model());
    const AbstractTreeItem* pAbstractItem = static_cast<const AbstractTreeItem*>(pBrainTreeModel->itemFromIndex(index));

    switch(pAbstractItem->type()) {
        case BrainTreeModelItemTypes::SurfaceColorGyri: {
            QColorDialog *pColorDialog = new QColorDialog(parent);
            pColorDialog->show();
            return pColorDialog;
        }

        case BrainTreeModelItemTypes::SurfaceColorSulci: {
            QColorDialog *pColorDialog = new QColorDialog(parent);
            pColorDialog->show();
            return pColorDialog;
        }

        case BrainTreeModelItemTypes::SurfaceColorInfoOrigin: {
            QComboBox* pComboBox = new QComboBox(parent);
            pComboBox->addItem("Color from curvature");
            pComboBox->addItem("Color from annotation");
            return pComboBox;
        }

        case BrainTreeModelItemTypes::RTDataColormapType: {
            QComboBox* pComboBox = new QComboBox(parent);
            pComboBox->addItem("Hot Negative 1");
            pComboBox->addItem("Hot Negative 2");
            pComboBox->addItem("Hot");
            return pComboBox;
        }

        case BrainTreeModelItemTypes::RTDataNormalizationValue: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            pDoubleSpinBox->setMinimum(0.01);
            pDoubleSpinBox->setMaximum(10.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setValue(index.model()->data(index, BrainTreeItemRoles::RTDataNormalizationValue).toDouble());
            return pDoubleSpinBox;
            break;
        }

        case BrainTreeModelItemTypes::RTDataTimeInterval: {
            QSpinBox* pSpinBox = new QSpinBox(parent);
            pSpinBox->setSuffix(" mSec");
            pSpinBox->setMinimum(17);
            pSpinBox->setMaximum(5000);
            pSpinBox->setValue(index.model()->data(index, BrainTreeItemRoles::RTDataTimeInterval).toInt());
            return pSpinBox;
            break;
        }
    }

    return QItemDelegate::createEditor(parent, option, index);
}