WSJT-X/MaidenheadLocatorValidator.hpp
Bill Somerville c586204d75 Add proper Qt validation for callsigns and grids
Two      new     validator      classes     CallsignValidator      and
MaidenheadLocatorValidator   are   introduced    and   used   in   the
Configuration and MainWindow implementations.

MaidenheadLocatorValidator  supports  different  lengths  and  minimum
required  lengths  with  a  default of  subsquare  with  square  being
required.

The  message_aggregator  application has  been  enhanced  to show  the
current DX call and DX grid as shown in the WSJT-X main window.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6903 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2016-07-10 22:20:30 +00:00

27 lines
696 B
C++

#ifndef MAIDENHEAD_LOCATOR_VALIDATOR_HPP__
#define MAIDENHEAD_LOCATOR_VALIDATOR_HPP__
#include <QValidator>
#include <QRegularExpression>
//
// MaidenheadLocatorValidator - QValidator implementation for grid locators
//
class MaidenheadLocatorValidator final
: public QValidator
{
public:
enum class Length {field = 2, square = 4, subsquare = 6, extended = 8};
MaidenheadLocatorValidator (QObject * parent = nullptr
, Length length = Length::subsquare
, Length required = Length::square);
// QValidator implementation
State validate (QString& input, int& pos) const override;
private:
QRegularExpression re_;
};
#endif