60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
// **************************************************************************
|
|
//
|
|
// (C) Copyright 2009 Swiss SIMTEC AG
|
|
//
|
|
// **************************************************************************
|
|
//
|
|
// $HeadURL$
|
|
// $LastChangedBy$
|
|
// $LastChangedDate$
|
|
// $LastChangedRevision$
|
|
//
|
|
// **************************************************************************
|
|
|
|
#include "LogViewSpinBox.hpp"
|
|
#include "LogViewField.hpp"
|
|
|
|
namespace N_LogView
|
|
{
|
|
|
|
// ---------------------------------------------------------------
|
|
LogViewSpinBox::LogViewSpinBox(LogViewField* a_field, QWidget* a_parent, const int a_value)
|
|
: QSpinBox(a_parent)
|
|
, LogViewWidget(a_field, this, a_parent, false)
|
|
{
|
|
// set range
|
|
uint16_t maxArraySize = a_field->maxArraySize();
|
|
setRange(0, maxArraySize);
|
|
|
|
// set the actual value
|
|
setValue(a_value);
|
|
|
|
// set tooltip-text
|
|
setToolTip(tr("<nobr>Wertebereich: 0..%1</nobr>").arg(maxArraySize));
|
|
|
|
// connect
|
|
connect(this, &LogViewSpinBox::editingFinished,
|
|
this, &LogViewSpinBox::finishEditing);
|
|
}
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
void LogViewSpinBox::finishEditing()
|
|
{
|
|
emit valueEditingFinished(text().toInt());
|
|
}
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
// Writes the content into telegram.
|
|
// Returns true if successful.
|
|
// ---------------------------------------------------------------
|
|
bool LogViewSpinBox::saveContent(LogViewTelegram* a_telegram)
|
|
{
|
|
Q_UNUSED(a_telegram);
|
|
// not yet implemented
|
|
return false;
|
|
}
|
|
|
|
} // namespace N_LogView
|