コード例 #1
1
ファイル: delegate.cpp プロジェクト: Oaks/sdb_recode
void Delegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
  if ( index.column() == COLUMN_TYPE ){
     setEditorData_TYPE(editor,index);return;
  }
  if ( index.column() == COLUMN_KEY_INV ){
      setEditorData_KEY_INV(editor,index);return;
  }
  if ( index.column() == COLUMN_TAGE_LAMP  || index.column() == COLUMN_TAGE_KEY ||
       index.column() == COLUMN_TAGE_TIT){
      setEditorData_LEdit(editor,index);return;
  }
int value = index.model()->data(index, Qt::EditRole).toInt();

  QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
  spinBox->setValue(value);
}
コード例 #2
0
ファイル: formdelegate.cpp プロジェクト: sythaeryn/pndrpg
	void FormDelegate::setEditorData(QWidget *editor,
		const QModelIndex &index) const
	{
		const CGeorgesFormProxyModel * mp = dynamic_cast<const CGeorgesFormProxyModel *>(index.model());
		const CGeorgesFormModel * m = dynamic_cast<const CGeorgesFormModel *>(mp->sourceModel());

		const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType();
		int numDefinitions = type->getNumDefinition();
		QString value = index.model()->data(index, Qt::DisplayRole).toString();

		if (numDefinitions) 
		{
			QComboBox *cb = static_cast<QComboBox*>(editor);
			cb->setCurrentIndex(cb->findText(value));
			//cb->setIconSize()
		}
		else 
		{
			switch (type->getType()) 
			{
			case NLGEORGES::UType::UnsignedInt:
			case NLGEORGES::UType::SignedInt:
				{
					QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
					spinBox->setValue((int)value.toDouble());
					break;
				}
			case NLGEORGES::UType::Double:
				{
					QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
					spinBox->setValue(value.toDouble());
					break;
				}
			case NLGEORGES::UType::Color:
				{
					break;
				}
			default:
				{
					QLineEdit *textEdit = static_cast<QLineEdit*>(editor);
					textEdit->setText(value);
					break;
				}
			}
		}
	}
コード例 #3
0
ファイル: moto.cpp プロジェクト: z80/avrusb
void Moto::saveLimits( QSettings & set )
{
    QStringList     names;
    QList<QSpinBox *> boxes;
    names << "maxThrottleCwMin"       << "maxThrottleCwMax"       << "maxThrottleCwVal"
          << "maxThrottleCcwMin"      << "maxThrottleCcwMax"      << "maxThrottleCcwVal"
          << "maxSpeedCwMin"          << "maxSpeedCwMax"          << "maxSpeedCwVal"
          << "maxSpeedCcwMin"         << "maxSpeedCcwMax"         << "maxSpeedCcwVal"
          << "throttleRampUpCwMin"    << "throttleRampUpCwMax"    << "throttleRampUpCwVal"
          << "throttleRampUpCcwMin"   << "throttleRampUpCcwMax"   << "throttleRampUpCcwVal"
          << "throttleRampDownCwMin"  << "throttleRampDownCwMax"  << "throttleRampDownCwVal"
          << "throttleRampDownCcwMin" << "throttleRampDownCcwMax" << "throttleRampDownCcwVal"
          << "stallThresholdMin"      << "stallThresholdMax"      << "stallThresholdVal"
          << "undervoltageCtrlMin"    << "undervoltageCtrlMax"    << "undervoltageCtrlVal"
          << "motorOvertempMin"       << "motorOvertempMax"       << "motorOvertempVal"
          << "controllerOvertempMin"  << "cotrollerOvertempMax"   << "controllerOvertempVal";
    boxes << ui.maxThrottleCw << ui.maxThrottleCcw << ui.maxSpeedCw << ui.maxSpeedCcw
    	  << ui.throttleRampUpCw << ui.throttleRampUpCcw << ui.throttleRampDownCw << ui.throttleRampDownCcw
    	  << ui.stallThreshold << ui.undervoltageCtrl << ui.motorOvertemp << ui.controllerOvertemp;
    int index = 0;
    int cnt = boxes.size();
    for ( int i=0; i<cnt; i++ )
    {
    	QSpinBox * s = boxes[i];
    	int f = s->minimum();
    	int t = s->maximum();
    	int v = s->value();
    	QString from = names.at( index );
    	QString to   = names.at( index+1 );
    	QString val  = names.at( index+2 );
    	index += 3;
    	set.setValue( from, f );
    	set.setValue( to,   t );
    	set.setValue( val,  v );
    }

    int v = ui.throttleMode->currentIndex();
    set.setValue( "throttleModeVal", v );
    v = ui.throttleType->currentIndex();
    set.setValue( "throttleTypeVal", v );
    v = ui.commutationMode->currentIndex();
    set.setValue( "commutationModeVal", v );
    v = set.value( "currentLimitVal", 0 ).toInt();
    ui.currentLimit->setCurrentIndex( v );
}
コード例 #4
0
void StatusDelegate::setModelData(QWidget *AEditor, QAbstractItemModel *AModel, const QModelIndex &AIndex) const
{
	bool allowEmptyText = true;
	switch (AIndex.data(STR_COLUMN).toInt())
	{
	case STC_NAME:
		allowEmptyText = false;
	case STC_MESSAGE:
		{
			QLineEdit *lineEdit = qobject_cast<QLineEdit *>(AEditor);
			if (lineEdit && (allowEmptyText || !lineEdit->text().trimmed().isEmpty()))
			{
				QString data = lineEdit->text();
				AModel->setData(AIndex,data,Qt::DisplayRole);
				AModel->setData(AIndex,data,STR_VALUE);
			}
			break;
		}
	case STC_STATUS:
		{
			QComboBox *comboBox = qobject_cast<QComboBox *>(AEditor);
			if (comboBox)
			{
				int data = comboBox->itemData(comboBox->currentIndex()).toInt();
				AModel->setData(AIndex,FStatusChanger->iconByShow(data),Qt::DecorationRole);
				AModel->setData(AIndex,FStatusChanger->nameByShow(data),Qt::DisplayRole);
				AModel->setData(AIndex,data,STR_VALUE);
			}
			break;
		}
	case STC_PRIORITY:
		{
			QSpinBox *spinBox = qobject_cast<QSpinBox *>(AEditor);
			if (spinBox)
			{
				int data = spinBox->value();
				AModel->setData(AIndex,data,Qt::DisplayRole);
				AModel->setData(AIndex,data,STR_VALUE);
			}
			break;
		}
	default:
		QStyledItemDelegate::setModelData(AEditor,AModel,AIndex);
	}
}
コード例 #5
0
ファイル: control_dialog.cpp プロジェクト: VasyaSV/Lab_4Sem
QWidget *TableDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    if (index.column() == 0) // figure type
    {
        QComboBox *combo_editor;
        combo_editor = new QComboBox(parent);
        combo_editor->addItem(tr("Piramid"));
        combo_editor->addItem(tr("Prisme"));
        return combo_editor;
    }
    else if (index.column() == 1 || index.column() == 5) // base type
    {
        QLabel *l_base = new QLabel(parent);
        return l_base;
    }
    else if (index.column() == 2) // hight
    {
        QSpinBox *editor = new QSpinBox(parent);
        editor->setMinimum(0);
        editor->setMaximum(1000);
        return editor;
    }
    else if (index.column() == 3) // hight possicion
    {
        QRegExp rx;
        rx.setPattern("(\\([0-9\\-][0-9]{0,6},[0-9\\-][0-9]{0,6},[0-9\\-][0-9]{0,6}\\)){1,1}");
        QRegExpValidator *validator = new QRegExpValidator(rx);
        QLineEdit *editor = new QLineEdit(parent);
        editor->setValidator(validator);
        QString currentText = index.model()->data(index, Qt::DisplayRole).toString();
        editor->setText(currentText);
        return editor;
    }
    else //if (index.column() == 4) // base points
    {
        QRegExp rx;
        rx.setPattern("(\\([0-9\\-][0-9]{0,6},[0-9\\-][0-9]{0,6},[0-9\\-][0-9]{0,6}\\)){0," + max_number_sites + "}");
        QRegExpValidator *validator = new QRegExpValidator(rx);
        QLineEdit *editor = new QLineEdit(parent);
        editor->setValidator(validator);
        QString currentText = index.model()->data(index, Qt::DisplayRole).toString();
        editor->setText(currentText);
        return editor;
    }
}
コード例 #6
0
ファイル: newviewdialog.cpp プロジェクト: andyvand/QTScope
/*!
    \fn newViewDialog::slotPluginSelected()
 */
void newViewDialog::slotPluginSelected()
{
	QString name = pluginsList->currentItem()->text();
	okPushButton->setEnabled( TRUE );
	
	QListIterator<pluginData> it(pl);
	while( it.hasNext() ){
		pluginData data = it.next();
		if ( data.name == name ){
			maxSelect = data.numChannels;

            int comediSubdevice = comedi_find_subdevice_by_type(comediDevice,data.type_comedi,0);
            if( comediSubdevice >= 0){
                maxChannels = comedi_get_n_channels(comediDevice, comediSubdevice);
                okPushButton->setEnabled(TRUE);
                status->setText(QString("comedi subdevice\ntype %1 found!").arg(data.type_comedi));
            }
            else{
                //comedi_perror( QString("error in %1 line %2").arg(__func__).arg(__LINE__).toStdString().c_str() );
                okPushButton->setEnabled(FALSE);
                maxChannels = 0;
                status->setText(QString("comedi subdevice\ntype %1 not found!").arg(data.type_comedi));
            }

            if( maxChannels < 0 ){
                maxChannels = 0;
                comedi_perror( QString("error in %1 line %2").arg(__func__).arg(__LINE__).toStdString().c_str() );
            }

			if(channelSelectors.count() < maxSelect)
				for( int i = channelSelectors.count(); i < maxSelect; i++ ) {
					QSpinBox *spinBox = new QSpinBox();
					spinBox->setRange( 0, maxChannels-1 );
					channelsListL->addWidget( spinBox );
					
					channelSelectors << spinBox ;
				}
			else if(channelSelectors.count() > maxSelect) {
				channelSelectors.last();
				for( int i = maxSelect; i< channelSelectors.count(); i++ )
					 delete channelSelectors.takeLast();
			}
        }
	}
}
コード例 #7
0
ファイル: columnlist.cpp プロジェクト: albar965/littlenavmap
void ColumnList::updateUnits()
{
  // Replace widget suffices and table headers
  for(Column *col : columns)
  {
    col->colDisplayName = Unit::replacePlaceholders(col->colOrigDisplayName);

    QSpinBox *sb = col->getSpinBoxWidget();
    if(sb != nullptr)
      sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colWidgetSuffix));

    sb = col->getMinSpinBoxWidget();
    if(sb != nullptr)
      sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colMinWidgetSuffix));

    sb = col->getMaxSpinBoxWidget();
    if(sb != nullptr)
      sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colMaxWidgetSuffix));
  }

  if(minDistanceWidget != nullptr)
    minDistanceWidget->setSuffix(
      Unit::replacePlaceholders(minDistanceWidget->suffix(), minDistanceWidgetSuffix));

  if(maxDistanceWidget != nullptr)
    maxDistanceWidget->setSuffix(
      Unit::replacePlaceholders(maxDistanceWidget->suffix(), maxDistanceWidgetSuffix));
}
コード例 #8
0
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::StringList: {
        QComboBox* cb = new QComboBox(parent);
        return cb;
    }
    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;
}
コード例 #9
0
ファイル: mainwindow.cpp プロジェクト: ogorodnikoff2012/Paint
void MainWindow::newFile()
{
    QSpinBox *width = new QSpinBox;
    QSpinBox *height = new QSpinBox;
    QCheckBox *transparentBackground = new QCheckBox(tr("Transparent background"));
    QDialog *dialog = createNewFileDialog(width, height, transparentBackground);
    int ans = dialog->exec();

    if (ans == QDialog::Accepted)
    {
        int w = width->value();
        int h = height->value();
        newFile(w, h, transparentBackground->isChecked());

    }

    delete dialog;
}
コード例 #10
0
void UIPropertySetters::ChacheSizeSetter(QWidget* editor, SettingsPropertyMapper::WidgetType editorType, SettingsPropertyMapper::PropertyType propertyType, QVariant propertyValue)
{
	if (editorType == SettingsPropertyMapper::SPINBOX)
	{
		QSpinBox* pSpinBox = qobject_cast<QSpinBox*>(editor);
		if (pSpinBox == NULL)
		{
			qCritical() << "SpinboxKBSetter support only ChacheSizeSetter. Unable to cast to ChacheSizeSetter.";
			return;
		}
		int val = propertyValue.toInt();
		pSpinBox->setValue(val * 16);
	}
	else
	{
		qCritical() << "SpinboxKBSetter support only ChacheSizeSetter";
	}
}
コード例 #11
0
void QtSpinBoxFactory::slotRangeChanged(QtProperty *property, int min, int max)
{
    if (!m_createdEditors.contains(property))
        return;

    QtIntPropertyManager *manager = this->propertyManager(property);
    if (!manager)
        return;

    QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
    while (itEditor.hasNext()) {
        QSpinBox *editor = itEditor.next();
        editor->blockSignals(true);
        editor->setRange(min, max);
        editor->setValue(manager->value(property));
        editor->blockSignals(false);
    }
}
コード例 #12
0
ファイル: gui_utils.cpp プロジェクト: brillywu/tea-qt
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;
}
コード例 #13
0
/*!
    Create and return the box used to modify number of states.
*/
QSpinBox* UiDigitalGenerator::createStatesBox()
{
    GeneratorDevice* device = DeviceManager::instance().activeDevice()
            ->generatorDevice();

    // Deallocation:
    //   Toolbar takes ownership when adding this box by call to
    //   toolBar->addWidget(mStatesBox) in createToolBar
    QSpinBox* box = new QSpinBox();
    box->setToolTip(tr("The number of digital states to use"));


    box->setRange(2, device->maxNumDigitalStates());

    connect(box, SIGNAL(valueChanged(int)), this, SLOT(setNumStates(int)));

    return box;
}
コード例 #14
0
QSpinBox* RenderSettingsWindow::create_integer_input(
    const string&           widget_key,
    const int               min,
    const int               max,
    const QString&          label)
{
    QSpinBox* spinbox = create_integer_input(widget_key, min, max);

    const QString suffix = " " + label;
    spinbox->setSuffix(suffix);

    QString text;
    text.setNum(max);
    text.append(suffix);
    set_widget_width_for_text(spinbox, text, SpinBoxMargin, SpinBoxMinWidth);

    return spinbox;
}
コード例 #15
0
void x264ZoneTableDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
	int value;

	if (index.column() == 2)
	{
		QComboBox *comboBox = static_cast<QComboBox*>(editor);
		value = comboBox->currentIndex();
	}
	else
	{
		QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
		spinBox->interpretText();
		value = spinBox->value();
	}

	model->setData(index, value, Qt::EditRole);
}
コード例 #16
0
/*!\func ODelegate::setModelData
 * установить данные в модель
 * \param нет
 * \return нет
 */
void ODelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
                                    const QModelIndex &index) const
{
    LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
    switch(index.column()) {
        case 0:
        {
            IdentificatorEdit *spinBox = static_cast<IdentificatorEdit*>(editor);
            QString value = spinBox->text();
            model->setData(index, value, Qt::EditRole);
            break;
        }
        case 1:
        {
            QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
            if(spinBox)
            {
                spinBox->interpretText();
                model->setData(index, spinBox->value(), Qt::EditRole);
            }
            break;
        }
        case 2:
        {
            LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
            QComboBox *spinBox = static_cast<QComboBox*>(editor);
            if(spinBox)
            {
                QString value = spinBox->currentText();
                model->setData(index, value, Qt::EditRole);
            }
            break;
        }
        case 3:
        {
            QLineEdit *spinBox = static_cast<QLineEdit*>(editor);
            if(spinBox)
            {
                model->setData(index, spinBox->text(), Qt::EditRole);
            }
            break;
        }
    }
}
コード例 #17
0
ファイル: TerrainWeightEditor.cpp プロジェクト: A-K/naali
    void TerrainWeightEditor::Initialize()
    {
        if (fw_->IsHeadless())
            return;

        QUiLoader loader;
        loader.setLanguageChangeEnabled(true);
        QString str("./data/ui/terrainwtex_editor.ui");
        QFile file(str);
        if(!file.exists())
        {
            EnvironmentModule::LogError("Cannot find " +str.toStdString()+ " file");
            return;
        }

        editor_widget_ = loader.load(&file, this);
        if (editor_widget_ == 0)
            return;

//        UiProxyWidget *editor_proxy = fw_->Ui()->AddWidgetToScene(this);
//        if (editor_proxy == 0)
//            return;

//        ui->AddWidgetToMenu(this, tr("Terrain Texture Weightmap Editor"));
//        ui->RegisterUniversalWidget("Weights", editor_proxy);

        QSpinBox *box = editor_widget_->findChild<QSpinBox*>("brush_size");
        if(box)
        {
            brush_size_max_ = box->maximum();
            brush_size_ = box->value();
        }
        box = editor_widget_->findChild<QSpinBox*>("brush_modifier");
        if(box)
            brush_modifier_ = box->maximum();

        QDoubleSpinBox *dbox = editor_widget_->findChild<QDoubleSpinBox*>("brush_falloff");
        if(dbox)
            falloff_percentage_ = dbox->value();

        InitializeCanvases();
        InitializeConnections();
        emit BrushValueChanged();
    }
コード例 #18
0
QWidget* PreferencesDialog::getFontsPage() {
    QWidget* widget = new QWidget();

    //---------------------
    // Font
    //---------------------
    GroupContainer *fontGroup = new GroupContainer;
    fontGroup->setTitle("Font");

    //Font Size
    QSpinBox* fontSizeCombo = new QSpinBox;
    fontSizeCombo->setMinimum(8);
    fontSizeCombo->setMaximum(14);
    fontSizeCombo->setValue(QApplication::font().pointSize());

    connect(fontSizeCombo, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), 
            [=] (int i){UserPreferences().setFontSize(i);});

    //Font Weight
    QComboBox *fontWeightCombo = new QComboBox;
    fontWeightCombo->addItems(QStringList() << "0" << "25" << "50" << "75");
    fontWeightCombo->setCurrentText(QString::number(QApplication::font().weight()));

    connect(fontWeightCombo, static_cast<void(QComboBox::*)(const QString&)> (&QComboBox::currentTextChanged),
            [ = ] (const QString & value){UserPreferences().setFontWeight(value);});

    QFormLayout *fontLayout = new QFormLayout;
    fontLayout->setRowWrapPolicy(QFormLayout::WrapLongRows);
    fontLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    fontLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    fontLayout->setLabelAlignment(Qt::AlignRight);
    fontLayout->addRow("Font Size", fontSizeCombo);
    fontLayout->addRow("Font Weight", fontWeightCombo);

    fontGroup->setContainerLayout(fontLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addWidget(fontGroup);
    mainLayout->addStretch(1);
    widget->setLayout(mainLayout);
    return widget;
}
コード例 #19
0
ファイル: phototimer.cpp プロジェクト: muromec/qtopia-ezx
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);

}
コード例 #20
0
	void readFromProperty(const value_type& v)
	{
		m_value = v;
		int prevNb = m_spinBox->value();
		int nb = list_traits::size(m_value);

		if (prevNb != nb)
		{
			if (m_spinBox)
				m_spinBox->setValue(nb);

			resize(nb);
		}
		else
		{
			for (auto w : m_propertyWidgets)
				w->updateWidgetValue();
		}
	}
コード例 #21
0
ファイル: delegate.cpp プロジェクト: Oaks/sdb_recode
void Delegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
  if ( index.column() == COLUMN_TYPE ){
      setModelData_TYPE(editor,model,index);return;
  }
  if ( index.column() == COLUMN_KEY_INV ){
      setModelData_KEY_INV(editor,model,index);return;
  }
  if ( index.column() == COLUMN_TAGE_LAMP  || index.column() == COLUMN_TAGE_KEY ||
       index.column() == COLUMN_TAGE_TIT){
      setModelData_LEdit(editor,model,index);return;
  }
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
  spinBox->interpretText();
  int value = spinBox->value();

  model->setData(index, value, Qt::EditRole);
  qDebug()<<QString("set model(%1,%2) :=%3").arg(index.column()).arg(index.row()).arg(value);
}
コード例 #22
0
ファイル: intsetting.cpp プロジェクト: A1-Triard/openmw
std::pair<QWidget *, QWidget *> CSMPrefs::IntSetting::makeWidgets (QWidget *parent)
{
    QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);

    QSpinBox *widget = new QSpinBox (parent);
    widget->setRange (mMin, mMax);
    widget->setValue (mDefault);

    if (!mTooltip.empty())
    {
        QString tooltip = QString::fromUtf8 (mTooltip.c_str());
        label->setToolTip (tooltip);
        widget->setToolTip (tooltip);
    }

    connect (widget, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int)));

    return std::make_pair (label, widget);
}
コード例 #23
0
Perlin3DObject * ImporterVSQ::Import(const std::string& path)
{

    VSQReader reader(path);

    // Dialog box creation
    QDialog frameNbDialog;
    QVBoxLayout * layout = new QVBoxLayout;
    QSpinBox * sbNumber = new QSpinBox(&frameNbDialog);
    QPushButton * bOk = new QPushButton("Ok", &frameNbDialog);
    sbNumber->setMaximum(reader.getNbFrame());
    layout->addWidget(sbNumber);
    layout->addWidget(bOk);
    frameNbDialog.setLayout(layout);
    QObject::connect(bOk, SIGNAL(clicked()), &frameNbDialog, SLOT(accept()));

    // We display the box
    frameNbDialog.exec();

    // We get back the value
    int frameNumber = sbNumber->value();

    int cubeSize = reader.getSize();
    float * density = reader.readFrame(frameNumber);

    glm::ivec3 Size = glm::ivec3();
    Size.x = cubeSize;
    Size.y = cubeSize;
    Size.z = cubeSize;
    Perlin3DObject * obj = new Perlin3DObject(Size);

    int cubeSizeSq = cubeSize * cubeSize;

    for (int i = 0; i < cubeSize; ++i)
        for (int j = 0; j < cubeSize; ++j)
            for (int k = 0; k < cubeSize; ++k){
                obj->SetData(density[i * cubeSizeSq + j * cubeSize + k],j,i,k);
            }

    delete[] density;

    return obj;
}
コード例 #24
0
/*!\func IDelegate::createEditor
 * установить данные в виджет
 * \param нет
 * \return нет
 */
void IDelegate::setEditorData(QWidget *editor,
				     const QModelIndex &index) const
{
    LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
    switch(index.column()) {
	case 0:
	{
	     LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
	     QString value = index.model()->data(index, Qt::EditRole).toString();
             IdentificatorEdit *spinBox = static_cast<IdentificatorEdit*>(editor);
	     spinBox->setText(value);
	}
	break;
	case 1:
	{
	     LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
	     int value = index.model()->data(index, Qt::EditRole).toInt();
	     QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
	     spinBox->setValue(value);
	}
	break;
	case 2:
	{
	    break;
	    LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
	    QString value = index.model()->data(index, Qt::EditRole).toString();
	    QComboBox *spinBox = static_cast<QComboBox*>(editor);
	    if(value == "reg")
	       spinBox->setCurrentIndex(1);
	    else
		   spinBox->setCurrentIndex(0);
	}
	break;
        case 3:
        {
             LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
             QString value = index.model()->data(index, Qt::EditRole).toString();
             QLineEdit *spinBox = static_cast<QLineEdit*>(editor);
             spinBox->setText(value);
        }
        break;
    }
}
コード例 #25
0
ファイル: param_widget.cpp プロジェクト: ashuang/sceneview
void ParamWidget::AddInt(const QString& name,
    int min, int max, int step, int initial_value,
    DisplayHint display_hint) {
  ExpectNameNotFound(name);

  if (display_hint == DisplayHint::kSpinBox) {
    QSpinBox* spinbox = new QSpinBox(this);
    spinbox->setRange(min, max);
    spinbox->setSingleStep(step);
    spinbox->setValue(initial_value);
    spinbox->setProperty("param_widget_type", kParamInt);
    widgets_[name] = spinbox;
    AddLabeledRow(name, spinbox);
    connect(spinbox,
        static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
        [this, name](int val) {
          emit ParamChanged(name);
        });
  } else if (display_hint == DisplayHint::kSlider) {
    QWidget* row_widget = new QWidget(this);
    QHBoxLayout* row_hbox = new QHBoxLayout(row_widget);
    QSlider* slider = new QSlider(Qt::Horizontal, this);
    slider->setRange(min, max);
    slider->setSingleStep(step);
    slider->setValue(initial_value);
    slider->setProperty("param_widget_type", kParamInt);
    QLabel* label = new QLabel(this);
    label->setText(QString::number(initial_value));
    row_hbox->addWidget(new QLabel(name, this));
    row_hbox->addWidget(slider);
    row_hbox->addWidget(label);
    widgets_[name] = slider;
    layout_->addWidget(row_widget);
    connect(slider, &QSlider::valueChanged,
        [this, name, label](int value) {
          label->setText(QString::number(value));
          emit ParamChanged(name);
        });
  } else {
    throw std::invalid_argument("Invalid display hint");
  }
}
コード例 #26
0
ファイル: blockbase.cpp プロジェクト: CNCBASHER/xenomai-lab
void BlockBase::newEntry(const QString& text, int* value)
{
    SettingsLock lock;
    QSpinBox *spinBox = new QSpinBox(this);
    spinBox->setMinimum(-1000000000);
    spinBox->setMaximum(1000000000);
    spinBox->setValue(*value);

    d_settingsLayout->addWidget(new QLabel(text,this),d_entryNum,0);
    d_settingsLayout->addWidget(spinBox,d_entryNum,1);


    connect(spinBox, SIGNAL(valueChanged(int)),
            this, SLOT(spinBoxChange(int)) );

    spinBoxes[spinBox]=value;
    originalInt[value]=*value;

    d_entryNum++;
}
コード例 #27
0
ファイル: ccolumndelegate.cpp プロジェクト: Pinkbyte/qtdiscs
QWidget *CColumnDelegate::createEditor(QWidget *parent,const QStyleOptionViewItem &option,const QModelIndex &index) const
{
    if (columnindex==ContentIndex)
    {
        QTextEdit* editor = new QTextEdit(parent);
        // disable rich text, we just need multilined QLineEdit functionality :-)
        editor->setAcceptRichText(false);
        return editor;
    }
    else
        if (columnindex==FullIndex)
        {
            // for 'full' column(data type: boolean) we should use SpinBox editor
            QSpinBox* editor = new QSpinBox(parent);
            editor->setRange(0,1);
            return editor;
        }
        else
            return QStyledItemDelegate::createEditor(parent,option,index);
}
コード例 #28
0
void ProgressDelegate::setEditorData(QWidget *editor,
                                     const QModelIndex &index) const {
  auto model = index.model();
  auto id =
      model->data(model->index(index.row(), ListRoles::ID), Qt::DisplayRole);

  AnimePtr anime = User::sharedUser()->getAnimeByID(id.toString());

  auto episodes_watched = anime->episodesWatched();
  auto total_episodes = anime->totalEpisodes();

  if (total_episodes == 0) {
    total_episodes = std::numeric_limits<int>::max();
  }

  QSpinBox *spinBox = static_cast<QSpinBox *>(editor);
  spinBox->setMaximum(total_episodes);
  spinBox->setValue(episodes_watched);
  spinBox->setSuffix(" / " + QString::number(anime->totalEpisodes()));
}
コード例 #29
0
ファイル: qavimator.cpp プロジェクト: CaiZhongda/icub-main
void qavimator::setupToolBar()
{
    QToolBar *toolBar = ui->toolBar;
    QLabel *label = new QLabel("FPS:",this);
    QSpinBox *fpsSpin = new QSpinBox(this);
    fpsSpin->setMaximum(1);
    fpsSpin->setMaximum(50);
    fpsSpin->setValue(10);
    QIcon ico = QIcon(":/icons/resetcamera.png");
    QPushButton *resetCamera = new QPushButton(ico,"",this);
    resetCamera->setToolTip("Reset camera view to default position");
    toolBar->addWidget(label);
    toolBar->addWidget(fpsSpin);
    toolBar->addSeparator();
    toolBar->addWidget(resetCamera);
    connect(fpsSpin,SIGNAL(valueChanged(int)),this,SLOT(onFpsSpinValueChanged(int)));
    connect(resetCamera,SIGNAL(clicked()),this,SLOT(onResetCamera()));


}
コード例 #30
0
ファイル: uspravy_subs_delegate.cpp プロジェクト: utech/tke
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void USpravy_subs_Delegate::setEditorData(QWidget *editor,
                                  const QModelIndex &index) const
{
	QSpinBox *spinbox;
	int value;
    if (   (index.column() == durationColumn_1)
		|| (index.column() == durationColumn_2) 
		|| (index.column() == durationColumn_4)
		|| (index.column() == durationColumn_3) 
		|| (index.column() == durationColumn_5)
		|| (index.column() == durationColumn_6)) {
			value = index.model()->data(index, Qt::DisplayRole).toInt();
			spinbox = qobject_cast<QSpinBox *>(editor);
			spinbox->setValue(value);
			spinbox->selectAll();
    }
	else {
        QSqlRelationalDelegate::setEditorData(editor, index);
    }
}