summaryrefslogtreecommitdiff
path: root/item_delegates/CallsignDelegate.hpp
blob: b5bdce1c2bd24be2b8ea8926bbbc7735a7a7174c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef CALLSIGN_DELEGATE_HPP_
#define CALLSIGN_DELEGATE_HPP_

#include <QStyledItemDelegate>

class QValidator;

//
// Class CallsignDelegate
//
//	Item delegate for editing a callsign
//
class CallsignDelegate final
  : public QStyledItemDelegate
{
public:
  explicit CallsignDelegate (QObject * parent = nullptr);
  QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const&, QModelIndex const&) const override;
  void setEditorData (QWidget * editor, QModelIndex const&) const override;
  void setModelData (QWidget * editor, QAbstractItemModel *, QModelIndex const&) const override;
  void updateEditorGeometry (QWidget * editor, QStyleOptionViewItem const& option, QModelIndex const&) const override
  {
    editor->setGeometry (option.rect);
  }

private:
  QScopedPointer<QValidator> validator_;
};

#endif