QGCParamSlider.cc 1.32 KB
Newer Older
1 2 3
#include <QMenu>
#include <QContextMenuEvent>

4 5 6 7
#include "QGCParamSlider.h"
#include "ui_QGCParamSlider.h"

QGCParamSlider::QGCParamSlider(QWidget *parent) :
8
    QGCToolWidgetItem(parent),
9 10 11
    ui(new Ui::QGCParamSlider)
{
    ui->setupUi(this);
12 13
    endEditMode();
    connect(ui->doneButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
14 15 16 17 18 19 20
}

QGCParamSlider::~QGCParamSlider()
{
    delete ui;
}

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
void QGCParamSlider::startEditMode()
{
    ui->doneButton->show();
    ui->maxLabel->show();
    ui->minLabel->show();
    ui->nameLineEdit->show();
    ui->instructionsLabel->show();
    ui->refreshParamsButton->show();
    ui->selectParamComboBox->show();
    ui->minSpinBox->show();
    ui->maxSpinBox->show();
    ui->typeComboBox->show();
    isInEditMode = true;
}

void QGCParamSlider::endEditMode()
{
    ui->doneButton->hide();
    ui->maxLabel->hide();
    ui->minLabel->hide();
    ui->nameLineEdit->hide();
    ui->instructionsLabel->hide();
    ui->refreshParamsButton->hide();
    ui->selectParamComboBox->hide();
    ui->minSpinBox->hide();
    ui->maxSpinBox->hide();
    ui->typeComboBox->hide();
    isInEditMode = false;
}

51 52 53 54 55 56 57 58 59 60 61
void QGCParamSlider::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}