mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
rename doublespindelegate files
This commit is contained in:
parent
7d7cbb5fce
commit
898bd7dbf1
@ -1,86 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file doublespindelegate.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
* @{
|
||||
* @brief A double spinbox delegate
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "doublespindelegate.h"
|
||||
|
||||
/**
|
||||
Helper delegate for the custom mixer editor table.
|
||||
*/
|
||||
DoubleSpinDelegate::DoubleSpinDelegate(QObject *parent)
|
||||
: QItemDelegate(parent)
|
||||
{
|
||||
m_min = 0.0;
|
||||
m_max = 1.0;
|
||||
m_decimals = 2;
|
||||
m_step = 0.01;
|
||||
}
|
||||
|
||||
QWidget *DoubleSpinDelegate::createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem &/* option */,
|
||||
const QModelIndex &/* index */) const
|
||||
{
|
||||
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
||||
editor->setMinimum(m_min);
|
||||
editor->setMaximum(m_max);
|
||||
editor->setDecimals(m_decimals);
|
||||
editor->setSingleStep(m_step);
|
||||
|
||||
connect(editor,SIGNAL(valueChanged(double)), this, SLOT(valueChanged()));
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
void DoubleSpinDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
double value = index.model()->data(index, Qt::EditRole).toDouble();
|
||||
|
||||
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
|
||||
spinBox->setValue(value);
|
||||
}
|
||||
|
||||
void DoubleSpinDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
|
||||
spinBox->interpretText();
|
||||
double value = spinBox->value();
|
||||
|
||||
model->setData(index, value, Qt::EditRole);
|
||||
}
|
||||
|
||||
void DoubleSpinDelegate::updateEditorGeometry(QWidget *editor,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
|
||||
{
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
|
||||
void DoubleSpinDelegate::valueChanged()
|
||||
{
|
||||
emit ValueChanged();
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file doublespindelegate.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
* @{
|
||||
* @brief A double spinbox delegate
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef DOUBLESPINDELEGATE_H
|
||||
#define DOUBLESPINDELEGATE_H
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QItemDelegate>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class DoubleSpinDelegate;
|
||||
}
|
||||
|
||||
class DoubleSpinDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DoubleSpinDelegate(QObject *parent = 0);
|
||||
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const;
|
||||
|
||||
void updateEditorGeometry(QWidget *editor,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
|
||||
void setMin(double min) { m_min = min; }
|
||||
void setMax(double max) { m_max = max; }
|
||||
void setRange(double min, double max) { m_min = min; m_max = max; }
|
||||
void setStep(double step) { m_step = step; }
|
||||
void setDecimals(int decimals) { m_decimals = decimals; }
|
||||
|
||||
private:
|
||||
double m_min;
|
||||
double m_max;
|
||||
double m_step;
|
||||
int m_decimals;
|
||||
|
||||
signals:
|
||||
void ValueChanged();
|
||||
|
||||
private slots:
|
||||
void valueChanged() ;
|
||||
};
|
||||
|
||||
#endif // DOUBLESPINDELEGATE_H
|
@ -38,7 +38,7 @@ HEADERS += configplugin.h \
|
||||
configrevowidget.h \
|
||||
config_global.h \
|
||||
mixercurve.h \
|
||||
doublespindelegate.h
|
||||
dblspindelegate.h
|
||||
SOURCES += configplugin.cpp \
|
||||
configgadgetconfiguration.cpp \
|
||||
configgadgetwidget.cpp \
|
||||
@ -71,7 +71,7 @@ SOURCES += configplugin.cpp \
|
||||
outputchannelform.cpp \
|
||||
cfg_vehicletypes/vehicleconfig.cpp \
|
||||
mixercurve.cpp \
|
||||
doublespindelegate.cpp
|
||||
dblspindelegate.cpp
|
||||
FORMS += airframe.ui \
|
||||
cc_hw_settings.ui \
|
||||
pro_hw_settings.ui \
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <QResizeEvent>
|
||||
#include <math.h>
|
||||
#include "mixercurve.h"
|
||||
#include "doublespindelegate.h"
|
||||
#include "dblspindelegate.h"
|
||||
|
||||
MixerCurve::MixerCurve(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "ui_mixercurve.h"
|
||||
#include "mixercurvewidget.h"
|
||||
#include "doublespindelegate.h"
|
||||
#include "dblspindelegate.h"
|
||||
#include "uavobjectwidgetutils_global.h"
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user