WSJT-X/FrequencyItemDelegate.hpp
Bill Somerville 248f78d780 Add validation to message entry fields.
All message  entry fields on the  mainscreen and in the  macro editing
facilities are now restricted to valid characters in the JT65/JT9 free
text message alphabet.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4362 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2014-09-25 11:36:01 +00:00

54 lines
1.4 KiB
C++

#ifndef FREQUENCY_ITEM_DELEGATE_HPP_
#define FREQUENCY_ITEM_DELEGATE_HPP_
#include <QStyledItemDelegate>
class Bands;
//
// Class FrequencyItemDelegate
//
// Item delegate for displaying and editing a Frequency item in a
// view that uses a FrequencyLineEdit as an item delegate for the
// edit role.
//
class FrequencyItemDelegate final
: public QStyledItemDelegate
{
public:
explicit FrequencyItemDelegate (Bands const * bands, QObject * parent = nullptr)
: QStyledItemDelegate {parent}
, bands_ {bands}
{
}
QString displayText (QVariant const& value, QLocale const&) const override;
QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const&, QModelIndex const&) const override;
private:
Bands const * bands_;
};
//
// Class FrequencyDeltaItemDelegate
//
// Item delegate for displaying and editing a FrequencyDelta item
// in a view that uses a FrequencyDeltaLineEdit as an item
// delegate for the edit role.
//
class FrequencyDeltaItemDelegate final
: public QStyledItemDelegate
{
public:
explicit FrequencyDeltaItemDelegate (QObject * parent = nullptr)
: QStyledItemDelegate {parent}
{
}
QString displayText (QVariant const& value, QLocale const&) const override;
QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const&, QModelIndex const&) const override;
};
#endif