summaryrefslogtreecommitdiff
path: root/item_delegates
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2022-08-23 10:23:16 +0200
committerChristoph Berg <christoph.berg@credativ.de>2022-08-23 10:23:16 +0200
commit2d1068e60bce7ae1fff11623454900e8cee956b1 (patch)
treeacebe276e30466ef0ab91bc3da5e379bec0d7dc5 /item_delegates
parent43bebfbad6e7ba026bd3d55720c7d9e12a7ef8ef (diff)
New upstream version 2.6.0~rc3+repackupstream/2.6.0_rc3+repack
Diffstat (limited to 'item_delegates')
-rwxr-xr-xitem_delegates/CallsignDelegate.cpp62
-rwxr-xr-xitem_delegates/CallsignDelegate.hpp60
-rwxr-xr-xitem_delegates/CandidateKeyFilter.cpp178
-rwxr-xr-xitem_delegates/CandidateKeyFilter.hpp82
-rwxr-xr-xitem_delegates/ForeignKeyDelegate.cpp122
-rwxr-xr-xitem_delegates/ForeignKeyDelegate.hpp86
-rwxr-xr-xitem_delegates/FrequencyDelegate.cpp54
-rwxr-xr-xitem_delegates/FrequencyDelegate.hpp42
-rwxr-xr-xitem_delegates/FrequencyDeltaDelegate.cpp52
-rwxr-xr-xitem_delegates/FrequencyDeltaDelegate.hpp42
-rwxr-xr-xitem_delegates/MaidenheadLocatorDelegate.cpp60
-rwxr-xr-xitem_delegates/MaidenheadLocatorDelegate.hpp60
-rwxr-xr-xitem_delegates/SQLiteDateTimeDelegate.cpp80
-rwxr-xr-xitem_delegates/SQLiteDateTimeDelegate.hpp46
-rwxr-xr-xitem_delegates/item_delegates.pri26
15 files changed, 526 insertions, 526 deletions
diff --git a/item_delegates/CallsignDelegate.cpp b/item_delegates/CallsignDelegate.cpp
index d3b9864c..074da6e2 100755
--- a/item_delegates/CallsignDelegate.cpp
+++ b/item_delegates/CallsignDelegate.cpp
@@ -1,31 +1,31 @@
-#include "CallsignDelegate.hpp"
-
-#include <QLineEdit>
-
-#include "validators/CallsignValidator.hpp"
-
-CallsignDelegate::CallsignDelegate (QObject * parent)
- : QStyledItemDelegate {parent}
- , validator_ {new CallsignValidator}
-{
-}
-
-QWidget * CallsignDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
- , QModelIndex const&) const
-{
- auto * editor = new QLineEdit {parent};
- editor->setFrame (false);
- editor->setValidator (validator_.data ());
- return editor;
-}
-
-void CallsignDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
-{
- static_cast<QLineEdit *> (editor)->setText (index.model ()->data (index, Qt::EditRole).toString ());
-}
-
-void CallsignDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
-{
- model->setData (index, static_cast<QLineEdit *> (editor)->text (), Qt::EditRole);
-}
-
+#include "CallsignDelegate.hpp"
+
+#include <QLineEdit>
+
+#include "validators/CallsignValidator.hpp"
+
+CallsignDelegate::CallsignDelegate (QObject * parent)
+ : QStyledItemDelegate {parent}
+ , validator_ {new CallsignValidator}
+{
+}
+
+QWidget * CallsignDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
+ , QModelIndex const&) const
+{
+ auto * editor = new QLineEdit {parent};
+ editor->setFrame (false);
+ editor->setValidator (validator_.data ());
+ return editor;
+}
+
+void CallsignDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
+{
+ static_cast<QLineEdit *> (editor)->setText (index.model ()->data (index, Qt::EditRole).toString ());
+}
+
+void CallsignDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
+{
+ model->setData (index, static_cast<QLineEdit *> (editor)->text (), Qt::EditRole);
+}
+
diff --git a/item_delegates/CallsignDelegate.hpp b/item_delegates/CallsignDelegate.hpp
index b5bdce1c..aeecc520 100755
--- a/item_delegates/CallsignDelegate.hpp
+++ b/item_delegates/CallsignDelegate.hpp
@@ -1,30 +1,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
+#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
diff --git a/item_delegates/CandidateKeyFilter.cpp b/item_delegates/CandidateKeyFilter.cpp
index 306e4102..cf08077e 100755
--- a/item_delegates/CandidateKeyFilter.cpp
+++ b/item_delegates/CandidateKeyFilter.cpp
@@ -1,89 +1,89 @@
-#include "CandidateKeyFilter.hpp"
-
-#include <QModelIndex>
-#include <QAbstractItemModel>
-
-#include "pimpl_impl.hpp"
-
-class CandidateKeyFilter::impl final
-{
-public:
- explicit impl (int referenced_key_column
- , int referenced_key_role
- , QAbstractItemModel const * referencing_model
- , int referencing_key_column
- , int referencing_key_role)
- : referencing_ {referencing_model}
- , referencing_key_column_ {referencing_key_column}
- , referencing_key_role_ {referencing_key_role}
- , referenced_key_column_ {referenced_key_column}
- , referenced_key_role_ {referenced_key_role}
- {
- }
-
- QAbstractItemModel const * referencing_;
- int referencing_key_column_;
- int referencing_key_role_;
- int referenced_key_column_;
- int referenced_key_role_;
- QModelIndex active_key_;
-};
-
-CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel const * referenced_model
- , int referenced_key_column
- , QObject * parent
- , int referenced_key_role)
- : QSortFilterProxyModel {parent}
- , m_ {referenced_key_column, referenced_key_role, nullptr, 0, Qt::EditRole}
-{
- setSourceModel (const_cast<QAbstractItemModel *> (referenced_model));
-}
-
-CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel const * referenced_model
- , QAbstractItemModel const * referencing_model
- , int referenced_key_column
- , int referencing_key_column
- , QObject * parent
- , int referenced_key_role
- , int referencing_key_role)
- : QSortFilterProxyModel {parent}
- , m_ {referenced_key_column, referenced_key_role, referencing_model, referencing_key_column, referencing_key_role}
-{
- setSourceModel (const_cast<QAbstractItemModel *> (referenced_model));
-}
-
-CandidateKeyFilter::~CandidateKeyFilter ()
-{
-}
-
-void CandidateKeyFilter::set_active_key (QModelIndex const& index)
-{
- if (m_->referencing_)
- {
- if (index.isValid () )
- {
- Q_ASSERT (index.column () == m_->referencing_key_column_);
- m_->active_key_ = index;
- }
- invalidateFilter ();
- }
-}
-
-bool CandidateKeyFilter::filterAcceptsRow (int candidate_row, QModelIndex const& candidate_parent) const
-{
- if (!m_->referencing_) // many to many passes all
- {
- return true;
- }
-
- auto candidate_key = sourceModel ()->index (candidate_row, m_->referenced_key_column_, candidate_parent).data (m_->referenced_key_role_);
-
- // Include the current key.
- if (m_->active_key_.isValid () && candidate_key == m_->active_key_.data (m_->referencing_key_role_))
- {
- return true;
- }
-
- // Filter out any candidates already in the referencing key rows.
- return m_->referencing_->match (m_->referencing_->index (0, m_->referencing_key_column_), m_->referencing_key_role_, candidate_key, 1, Qt::MatchExactly).isEmpty ();
-}
+#include "CandidateKeyFilter.hpp"
+
+#include <QModelIndex>
+#include <QAbstractItemModel>
+
+#include "pimpl_impl.hpp"
+
+class CandidateKeyFilter::impl final
+{
+public:
+ explicit impl (int referenced_key_column
+ , int referenced_key_role
+ , QAbstractItemModel const * referencing_model
+ , int referencing_key_column
+ , int referencing_key_role)
+ : referencing_ {referencing_model}
+ , referencing_key_column_ {referencing_key_column}
+ , referencing_key_role_ {referencing_key_role}
+ , referenced_key_column_ {referenced_key_column}
+ , referenced_key_role_ {referenced_key_role}
+ {
+ }
+
+ QAbstractItemModel const * referencing_;
+ int referencing_key_column_;
+ int referencing_key_role_;
+ int referenced_key_column_;
+ int referenced_key_role_;
+ QModelIndex active_key_;
+};
+
+CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel const * referenced_model
+ , int referenced_key_column
+ , QObject * parent
+ , int referenced_key_role)
+ : QSortFilterProxyModel {parent}
+ , m_ {referenced_key_column, referenced_key_role, nullptr, 0, Qt::EditRole}
+{
+ setSourceModel (const_cast<QAbstractItemModel *> (referenced_model));
+}
+
+CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel const * referenced_model
+ , QAbstractItemModel const * referencing_model
+ , int referenced_key_column
+ , int referencing_key_column
+ , QObject * parent
+ , int referenced_key_role
+ , int referencing_key_role)
+ : QSortFilterProxyModel {parent}
+ , m_ {referenced_key_column, referenced_key_role, referencing_model, referencing_key_column, referencing_key_role}
+{
+ setSourceModel (const_cast<QAbstractItemModel *> (referenced_model));
+}
+
+CandidateKeyFilter::~CandidateKeyFilter ()
+{
+}
+
+void CandidateKeyFilter::set_active_key (QModelIndex const& index)
+{
+ if (m_->referencing_)
+ {
+ if (index.isValid () )
+ {
+ Q_ASSERT (index.column () == m_->referencing_key_column_);
+ m_->active_key_ = index;
+ }
+ invalidateFilter ();
+ }
+}
+
+bool CandidateKeyFilter::filterAcceptsRow (int candidate_row, QModelIndex const& candidate_parent) const
+{
+ if (!m_->referencing_) // many to many passes all
+ {
+ return true;
+ }
+
+ auto candidate_key = sourceModel ()->index (candidate_row, m_->referenced_key_column_, candidate_parent).data (m_->referenced_key_role_);
+
+ // Include the current key.
+ if (m_->active_key_.isValid () && candidate_key == m_->active_key_.data (m_->referencing_key_role_))
+ {
+ return true;
+ }
+
+ // Filter out any candidates already in the referencing key rows.
+ return m_->referencing_->match (m_->referencing_->index (0, m_->referencing_key_column_), m_->referencing_key_role_, candidate_key, 1, Qt::MatchExactly).isEmpty ();
+}
diff --git a/item_delegates/CandidateKeyFilter.hpp b/item_delegates/CandidateKeyFilter.hpp
index 27f1892b..60801350 100755
--- a/item_delegates/CandidateKeyFilter.hpp
+++ b/item_delegates/CandidateKeyFilter.hpp
@@ -1,41 +1,41 @@
-#ifndef CANDIDATE_KEY_FILTER_HPP_
-#define CANDIDATE_KEY_FILTER_HPP_
-
-#include <QSortFilterProxyModel>
-#include <QModelIndex>
-
-#include "pimpl_h.hpp"
-
-class QAbstractItemModel;
-
-class CandidateKeyFilter final
- : public QSortFilterProxyModel
-{
-public:
- explicit CandidateKeyFilter (QAbstractItemModel const * referenced_model
- , int referenced_key_column
- , QObject * parent = nullptr
- , int referenced_key_role = Qt::EditRole);
- explicit CandidateKeyFilter (QAbstractItemModel const * referenced_model
- , QAbstractItemModel const * referencing_model
- , int referenced_key_column
- , int referencing_key_column
- , QObject * parent = nullptr
- , int referenced_key_role = Qt::EditRole
- , int referencing_key_role = Qt::EditRole);
- ~CandidateKeyFilter ();
-
- // this key is not to be filtered, usually because we want to allow
- // it since we are editing the row that contains it this it is valid
- // even though it is in use
- void set_active_key (QModelIndex const& index = QModelIndex {});
-
-protected:
- bool filterAcceptsRow (int candidate_row, QModelIndex const& candidate_parent) const override;
-
-private:
- class impl;
- pimpl<impl> m_;
-};
-
-#endif
+#ifndef CANDIDATE_KEY_FILTER_HPP_
+#define CANDIDATE_KEY_FILTER_HPP_
+
+#include <QSortFilterProxyModel>
+#include <QModelIndex>
+
+#include "pimpl_h.hpp"
+
+class QAbstractItemModel;
+
+class CandidateKeyFilter final
+ : public QSortFilterProxyModel
+{
+public:
+ explicit CandidateKeyFilter (QAbstractItemModel const * referenced_model
+ , int referenced_key_column
+ , QObject * parent = nullptr
+ , int referenced_key_role = Qt::EditRole);
+ explicit CandidateKeyFilter (QAbstractItemModel const * referenced_model
+ , QAbstractItemModel const * referencing_model
+ , int referenced_key_column
+ , int referencing_key_column
+ , QObject * parent = nullptr
+ , int referenced_key_role = Qt::EditRole
+ , int referencing_key_role = Qt::EditRole);
+ ~CandidateKeyFilter ();
+
+ // this key is not to be filtered, usually because we want to allow
+ // it since we are editing the row that contains it this it is valid
+ // even though it is in use
+ void set_active_key (QModelIndex const& index = QModelIndex {});
+
+protected:
+ bool filterAcceptsRow (int candidate_row, QModelIndex const& candidate_parent) const override;
+
+private:
+ class impl;
+ pimpl<impl> m_;
+};
+
+#endif
diff --git a/item_delegates/ForeignKeyDelegate.cpp b/item_delegates/ForeignKeyDelegate.cpp
index 9ce0bd17..2c9219d6 100755
--- a/item_delegates/ForeignKeyDelegate.cpp
+++ b/item_delegates/ForeignKeyDelegate.cpp
@@ -1,61 +1,61 @@
-#include "ForeignKeyDelegate.hpp"
-
-#include <QApplication>
-#include <QComboBox>
-#include <QFontMetrics>
-#include <QSize>
-#include <QStyleOptionViewItem>
-#include "CandidateKeyFilter.hpp"
-
-ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel const * referenced_model
- , int referenced_key_column
- , QObject * parent
- , int referenced_key_role)
- : QStyledItemDelegate {parent}
- , candidate_key_filter_ {new CandidateKeyFilter {referenced_model, referenced_key_column, nullptr, referenced_key_role}}
-{
-}
-
-ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel const * referenced_model
- , QAbstractItemModel const * referencing_model
- , int referenced_key_column
- , int referencing_key_column
- , QObject * parent
- , int referenced_key_role
- , int referencing_key_role)
- : QStyledItemDelegate {parent}
- , candidate_key_filter_ {new CandidateKeyFilter {referenced_model, referencing_model, referenced_key_column, referencing_key_column, nullptr, referenced_key_role, referencing_key_role}}
-{
-}
-
-ForeignKeyDelegate::~ForeignKeyDelegate ()
-{
-}
-
-QWidget * ForeignKeyDelegate::createEditor (QWidget * parent
- , QStyleOptionViewItem const& /* option */
- , QModelIndex const& index) const
-{
- auto editor = new QComboBox {parent};
- editor->setFrame (false);
- candidate_key_filter_->set_active_key (index);
- editor->setModel (candidate_key_filter_.data ());
- editor->setSizeAdjustPolicy (QComboBox::AdjustToContents);
- return editor;
-}
-
-QSize ForeignKeyDelegate::sizeHint (QStyleOptionViewItem const& option, QModelIndex const& index) const
-{
- auto size_hint = QStyledItemDelegate::sizeHint (option, index);
- QFontMetrics metrics {option.font};
- QStyleOptionComboBox combo_box_option;
- combo_box_option.rect = option.rect;
- combo_box_option.state = option.state | QStyle::State_Enabled;
- for (auto row = 0; row < candidate_key_filter_->rowCount (); ++row)
- {
- size_hint = size_hint.expandedTo (qApp->style ()->sizeFromContents (QStyle::CT_ComboBox
- , &combo_box_option
- , metrics.boundingRect (candidate_key_filter_->data (candidate_key_filter_->index (row, 0)).toString ()).size ()));
- }
- return size_hint;
-}
+#include "ForeignKeyDelegate.hpp"
+
+#include <QApplication>
+#include <QComboBox>
+#include <QFontMetrics>
+#include <QSize>
+#include <QStyleOptionViewItem>
+#include "CandidateKeyFilter.hpp"
+
+ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel const * referenced_model
+ , int referenced_key_column
+ , QObject * parent
+ , int referenced_key_role)
+ : QStyledItemDelegate {parent}
+ , candidate_key_filter_ {new CandidateKeyFilter {referenced_model, referenced_key_column, nullptr, referenced_key_role}}
+{
+}
+
+ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel const * referenced_model
+ , QAbstractItemModel const * referencing_model
+ , int referenced_key_column
+ , int referencing_key_column
+ , QObject * parent
+ , int referenced_key_role
+ , int referencing_key_role)
+ : QStyledItemDelegate {parent}
+ , candidate_key_filter_ {new CandidateKeyFilter {referenced_model, referencing_model, referenced_key_column, referencing_key_column, nullptr, referenced_key_role, referencing_key_role}}
+{
+}
+
+ForeignKeyDelegate::~ForeignKeyDelegate ()
+{
+}
+
+QWidget * ForeignKeyDelegate::createEditor (QWidget * parent
+ , QStyleOptionViewItem const& /* option */
+ , QModelIndex const& index) const
+{
+ auto editor = new QComboBox {parent};
+ editor->setFrame (false);
+ candidate_key_filter_->set_active_key (index);
+ editor->setModel (candidate_key_filter_.data ());
+ editor->setSizeAdjustPolicy (QComboBox::AdjustToContents);
+ return editor;
+}
+
+QSize ForeignKeyDelegate::sizeHint (QStyleOptionViewItem const& option, QModelIndex const& index) const
+{
+ auto size_hint = QStyledItemDelegate::sizeHint (option, index);
+ QFontMetrics metrics {option.font};
+ QStyleOptionComboBox combo_box_option;
+ combo_box_option.rect = option.rect;
+ combo_box_option.state = option.state | QStyle::State_Enabled;
+ for (auto row = 0; row < candidate_key_filter_->rowCount (); ++row)
+ {
+ size_hint = size_hint.expandedTo (qApp->style ()->sizeFromContents (QStyle::CT_ComboBox
+ , &combo_box_option
+ , metrics.boundingRect (candidate_key_filter_->data (candidate_key_filter_->index (row, 0)).toString ()).size ()));
+ }
+ return size_hint;
+}
diff --git a/item_delegates/ForeignKeyDelegate.hpp b/item_delegates/ForeignKeyDelegate.hpp
index 4f58f460..696fc32b 100755
--- a/item_delegates/ForeignKeyDelegate.hpp
+++ b/item_delegates/ForeignKeyDelegate.hpp
@@ -1,43 +1,43 @@
-#ifndef FOREIGN_KEY_DELEGATE_HPP_
-#define FOREIGN_KEY_DELEGATE_HPP_
-
-#include <QStyledItemDelegate>
-#include <QScopedPointer>
-
-class CandidateKeyFilter;
-
-//
-// Class ForeignKeyDelegate
-//
-// Item delegate for editing a foreign key item in a one or many
-// to one relationship. A QComboBox is used as an item delegate
-// for the edit role.
-//
-class ForeignKeyDelegate final
- : public QStyledItemDelegate
-{
-public:
- // many to many relationship
- explicit ForeignKeyDelegate (QAbstractItemModel const * referenced_model
- , int referenced_key_column
- , QObject * parent = nullptr
- , int referenced_key_role = Qt::EditRole);
-
- // one to many (referenced to referencing) relationship
- explicit ForeignKeyDelegate (QAbstractItemModel const * referenced_model
- , QAbstractItemModel const * referencing_model
- , int referenced_key_column
- , int referencing_key_column
- , QObject * parent = nullptr
- , int referenced_key_role = Qt::EditRole
- , int referencing_key_role = Qt::EditRole);
- ~ForeignKeyDelegate ();
-
-private:
- QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const&, QModelIndex const&) const override;
- QSize sizeHint (QStyleOptionViewItem const&, QModelIndex const&) const override;
-
- QScopedPointer<CandidateKeyFilter> candidate_key_filter_;
-};
-
-#endif
+#ifndef FOREIGN_KEY_DELEGATE_HPP_
+#define FOREIGN_KEY_DELEGATE_HPP_
+
+#include <QStyledItemDelegate>
+#include <QScopedPointer>
+
+class CandidateKeyFilter;
+
+//
+// Class ForeignKeyDelegate
+//
+// Item delegate for editing a foreign key item in a one or many
+// to one relationship. A QComboBox is used as an item delegate
+// for the edit role.
+//
+class ForeignKeyDelegate final
+ : public QStyledItemDelegate
+{
+public:
+ // many to many relationship
+ explicit ForeignKeyDelegate (QAbstractItemModel const * referenced_model
+ , int referenced_key_column
+ , QObject * parent = nullptr
+ , int referenced_key_role = Qt::EditRole);
+
+ // one to many (referenced to referencing) relationship
+ explicit ForeignKeyDelegate (QAbstractItemModel const * referenced_model
+ , QAbstractItemModel const * referencing_model
+ , int referenced_key_column
+ , int referencing_key_column
+ , QObject * parent = nullptr
+ , int referenced_key_role = Qt::EditRole
+ , int referencing_key_role = Qt::EditRole);
+ ~ForeignKeyDelegate ();
+
+private:
+ QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const&, QModelIndex const&) const override;
+ QSize sizeHint (QStyleOptionViewItem const&, QModelIndex const&) const override;
+
+ QScopedPointer<CandidateKeyFilter> candidate_key_filter_;
+};
+
+#endif
diff --git a/item_delegates/FrequencyDelegate.cpp b/item_delegates/FrequencyDelegate.cpp
index b899c056..da081dd0 100755
--- a/item_delegates/FrequencyDelegate.cpp
+++ b/item_delegates/FrequencyDelegate.cpp
@@ -1,27 +1,27 @@
-#include "FrequencyDelegate.hpp"
-
-#include "widgets/FrequencyLineEdit.hpp"
-
-FrequencyDelegate::FrequencyDelegate (QObject * parent)
- : QStyledItemDelegate {parent}
-{
-}
-
-QWidget * FrequencyDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
- , QModelIndex const&) const
-{
- auto * editor = new FrequencyLineEdit {parent};
- editor->setFrame (false);
- return editor;
-}
-
-void FrequencyDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
-{
- static_cast<FrequencyLineEdit *> (editor)->frequency (index.model ()->data (index, Qt::EditRole).value<Radio::Frequency> ());
-}
-
-void FrequencyDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
-{
- model->setData (index, static_cast<FrequencyLineEdit *> (editor)->frequency (), Qt::EditRole);
-}
-
+#include "FrequencyDelegate.hpp"
+
+#include "widgets/FrequencyLineEdit.hpp"
+
+FrequencyDelegate::FrequencyDelegate (QObject * parent)
+ : QStyledItemDelegate {parent}
+{
+}
+
+QWidget * FrequencyDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
+ , QModelIndex const&) const
+{
+ auto * editor = new FrequencyLineEdit {parent};
+ editor->setFrame (false);
+ return editor;
+}
+
+void FrequencyDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
+{
+ static_cast<FrequencyLineEdit *> (editor)->frequency (index.model ()->data (index, Qt::EditRole).value<Radio::Frequency> ());
+}
+
+void FrequencyDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
+{
+ model->setData (index, static_cast<FrequencyLineEdit *> (editor)->frequency (), Qt::EditRole);
+}
+
diff --git a/item_delegates/FrequencyDelegate.hpp b/item_delegates/FrequencyDelegate.hpp
index 76fc5545..9278f6b4 100755
--- a/item_delegates/FrequencyDelegate.hpp
+++ b/item_delegates/FrequencyDelegate.hpp
@@ -1,21 +1,21 @@
-#ifndef FREQUENCY_DELEGATE_HPP_
-#define FREQUENCY_DELEGATE_HPP_
-
-#include <QStyledItemDelegate>
-
-//
-// Class FrequencyDelegate
-//
-// Item delegate for editing a frequency in Hertz but displayed in MHz
-//
-class FrequencyDelegate final
- : public QStyledItemDelegate
-{
-public:
- explicit FrequencyDelegate (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;
-};
-
-#endif
+#ifndef FREQUENCY_DELEGATE_HPP_
+#define FREQUENCY_DELEGATE_HPP_
+
+#include <QStyledItemDelegate>
+
+//
+// Class FrequencyDelegate
+//
+// Item delegate for editing a frequency in Hertz but displayed in MHz
+//
+class FrequencyDelegate final
+ : public QStyledItemDelegate
+{
+public:
+ explicit FrequencyDelegate (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;
+};
+
+#endif
diff --git a/item_delegates/FrequencyDeltaDelegate.cpp b/item_delegates/FrequencyDeltaDelegate.cpp
index 40d90dc5..6dc466af 100755
--- a/item_delegates/FrequencyDeltaDelegate.cpp
+++ b/item_delegates/FrequencyDeltaDelegate.cpp
@@ -1,26 +1,26 @@
-#include "FrequencyDeltaDelegate.hpp"
-
-#include "widgets/FrequencyDeltaLineEdit.hpp"
-
-FrequencyDeltaDelegate::FrequencyDeltaDelegate (QObject * parent)
- : QStyledItemDelegate {parent}
-{
-}
-
-QWidget * FrequencyDeltaDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
- , QModelIndex const&) const
-{
- auto * editor = new FrequencyDeltaLineEdit {parent};
- editor->setFrame (false);
- return editor;
-}
-
-void FrequencyDeltaDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
-{
- static_cast<FrequencyDeltaLineEdit *> (editor)->frequency_delta (index.model ()->data (index, Qt::EditRole).value<Radio::FrequencyDelta> ());
-}
-
-void FrequencyDeltaDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
-{
- model->setData (index, static_cast<FrequencyDeltaLineEdit *> (editor)->frequency_delta (), Qt::EditRole);
-}
+#include "FrequencyDeltaDelegate.hpp"
+
+#include "widgets/FrequencyDeltaLineEdit.hpp"
+
+FrequencyDeltaDelegate::FrequencyDeltaDelegate (QObject * parent)
+ : QStyledItemDelegate {parent}
+{
+}
+
+QWidget * FrequencyDeltaDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
+ , QModelIndex const&) const
+{
+ auto * editor = new FrequencyDeltaLineEdit {parent};
+ editor->setFrame (false);
+ return editor;
+}
+
+void FrequencyDeltaDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
+{
+ static_cast<FrequencyDeltaLineEdit *> (editor)->frequency_delta (index.model ()->data (index, Qt::EditRole).value<Radio::FrequencyDelta> ());
+}
+
+void FrequencyDeltaDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
+{
+ model->setData (index, static_cast<FrequencyDeltaLineEdit *> (editor)->frequency_delta (), Qt::EditRole);
+}
diff --git a/item_delegates/FrequencyDeltaDelegate.hpp b/item_delegates/FrequencyDeltaDelegate.hpp
index 121bc3d9..4188fd23 100755
--- a/item_delegates/FrequencyDeltaDelegate.hpp
+++ b/item_delegates/FrequencyDeltaDelegate.hpp
@@ -1,21 +1,21 @@
-#ifndef FREQUENCY_DELTA_DELEGATE_HPP_
-#define FREQUENCY_DELTA_DELEGATE_HPP_
-
-#include <QStyledItemDelegate>
-
-//
-// Class FrequencyDeltaDelegate
-//
-// Item delegate for editing a frequency delta in Hertz but displayed in MHz
-//
-class FrequencyDeltaDelegate final
- : public QStyledItemDelegate
-{
-public:
- explicit FrequencyDeltaDelegate (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;
-};
-
-#endif
+#ifndef FREQUENCY_DELTA_DELEGATE_HPP_
+#define FREQUENCY_DELTA_DELEGATE_HPP_
+
+#include <QStyledItemDelegate>
+
+//
+// Class FrequencyDeltaDelegate
+//
+// Item delegate for editing a frequency delta in Hertz but displayed in MHz
+//
+class FrequencyDeltaDelegate final
+ : public QStyledItemDelegate
+{
+public:
+ explicit FrequencyDeltaDelegate (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;
+};
+
+#endif
diff --git a/item_delegates/MaidenheadLocatorDelegate.cpp b/item_delegates/MaidenheadLocatorDelegate.cpp
index 7768f2a8..44cc42ce 100755
--- a/item_delegates/MaidenheadLocatorDelegate.cpp
+++ b/item_delegates/MaidenheadLocatorDelegate.cpp
@@ -1,30 +1,30 @@
-#include "MaidenheadLocatorDelegate.hpp"
-
-#include <QLineEdit>
-
-#include "validators/MaidenheadLocatorValidator.hpp"
-
-MaidenheadLocatorDelegate::MaidenheadLocatorDelegate (QObject * parent)
- : QStyledItemDelegate {parent}
- , validator_ {new MaidenheadLocatorValidator}
-{
-}
-
-QWidget * MaidenheadLocatorDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
- , QModelIndex const&) const
-{
- auto * editor = new QLineEdit {parent};
- editor->setFrame (false);
- editor->setValidator (validator_.data ());
- return editor;
-}
-
-void MaidenheadLocatorDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
-{
- static_cast<QLineEdit *> (editor)->setText (index.model ()->data (index, Qt::EditRole).toString ());
-}
-
-void MaidenheadLocatorDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
-{
- model->setData (index, static_cast<QLineEdit *> (editor)->text (), Qt::EditRole);
-}
+#include "MaidenheadLocatorDelegate.hpp"
+
+#include <QLineEdit>
+
+#include "validators/MaidenheadLocatorValidator.hpp"
+
+MaidenheadLocatorDelegate::MaidenheadLocatorDelegate (QObject * parent)
+ : QStyledItemDelegate {parent}
+ , validator_ {new MaidenheadLocatorValidator}
+{
+}
+
+QWidget * MaidenheadLocatorDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
+ , QModelIndex const&) const
+{
+ auto * editor = new QLineEdit {parent};
+ editor->setFrame (false);
+ editor->setValidator (validator_.data ());
+ return editor;
+}
+
+void MaidenheadLocatorDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
+{
+ static_cast<QLineEdit *> (editor)->setText (index.model ()->data (index, Qt::EditRole).toString ());
+}
+
+void MaidenheadLocatorDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
+{
+ model->setData (index, static_cast<QLineEdit *> (editor)->text (), Qt::EditRole);
+}
diff --git a/item_delegates/MaidenheadLocatorDelegate.hpp b/item_delegates/MaidenheadLocatorDelegate.hpp
index 39627523..9a4a7f82 100755
--- a/item_delegates/MaidenheadLocatorDelegate.hpp
+++ b/item_delegates/MaidenheadLocatorDelegate.hpp
@@ -1,30 +1,30 @@
-#ifndef MAIDENHEAD_LOCATOR_DELEGATE_HPP_
-#define MAIDENHEAD_LOCATOR_DELEGATE_HPP_
-
-#include <QStyledItemDelegate>
-
-class QValidator;
-
-//
-// Class MaidenheadLocatorDelegate
-//
-// Item delegate for editing a Maidenhead locator
-//
-class MaidenheadLocatorDelegate final
- : public QStyledItemDelegate
-{
-public:
- explicit MaidenheadLocatorDelegate (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
+#ifndef MAIDENHEAD_LOCATOR_DELEGATE_HPP_
+#define MAIDENHEAD_LOCATOR_DELEGATE_HPP_
+
+#include <QStyledItemDelegate>
+
+class QValidator;
+
+//
+// Class MaidenheadLocatorDelegate
+//
+// Item delegate for editing a Maidenhead locator
+//
+class MaidenheadLocatorDelegate final
+ : public QStyledItemDelegate
+{
+public:
+ explicit MaidenheadLocatorDelegate (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
diff --git a/item_delegates/SQLiteDateTimeDelegate.cpp b/item_delegates/SQLiteDateTimeDelegate.cpp
index 1cf8ad26..bd49017b 100755
--- a/item_delegates/SQLiteDateTimeDelegate.cpp
+++ b/item_delegates/SQLiteDateTimeDelegate.cpp
@@ -1,40 +1,40 @@
-#include "SQLiteDateTimeDelegate.hpp"
-
-#include <QDateTimeEdit>
-#include <QDateTime>
-#include <QLocale>
-
-SQLiteDateTimeDelegate::SQLiteDateTimeDelegate (QObject * parent)
- : QStyledItemDelegate {parent}
-{
-}
-
-QWidget * SQLiteDateTimeDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
- , QModelIndex const&) const
-{
- auto * editor = new QDateTimeEdit {parent};
- editor->setCalendarPopup (true);
- editor->setDisplayFormat (QLocale {}.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
- editor->setFrame (false);
- return editor;
-}
-
-void SQLiteDateTimeDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
-{
- auto const& value = index.model ()->data (index, Qt::EditRole);
- if (value.isValid () && !value.isNull ())
- {
- static_cast<QDateTimeEdit *> (editor)->setDateTime (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC));
- }
-}
-
-void SQLiteDateTimeDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
-{
- QVariant data;
- auto const& value = static_cast<QDateTimeEdit *> (editor)->dateTime ();
- if (value.isValid () && !value.isNull ())
- {
- data = value.toMSecsSinceEpoch () / 1000ull;
- }
- model->setData (index, data, Qt::EditRole);
-}
+#include "SQLiteDateTimeDelegate.hpp"
+
+#include <QDateTimeEdit>
+#include <QDateTime>
+#include <QLocale>
+
+SQLiteDateTimeDelegate::SQLiteDateTimeDelegate (QObject * parent)
+ : QStyledItemDelegate {parent}
+{
+}
+
+QWidget * SQLiteDateTimeDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
+ , QModelIndex const&) const
+{
+ auto * editor = new QDateTimeEdit {parent};
+ editor->setCalendarPopup (true);
+ editor->setDisplayFormat (QLocale {}.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
+ editor->setFrame (false);
+ return editor;
+}
+
+void SQLiteDateTimeDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
+{
+ auto const& value = index.model ()->data (index, Qt::EditRole);
+ if (value.isValid () && !value.isNull ())
+ {
+ static_cast<QDateTimeEdit *> (editor)->setDateTime (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC));
+ }
+}
+
+void SQLiteDateTimeDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
+{
+ QVariant data;
+ auto const& value = static_cast<QDateTimeEdit *> (editor)->dateTime ();
+ if (value.isValid () && !value.isNull ())
+ {
+ data = value.toMSecsSinceEpoch () / 1000ull;
+ }
+ model->setData (index, data, Qt::EditRole);
+}
diff --git a/item_delegates/SQLiteDateTimeDelegate.hpp b/item_delegates/SQLiteDateTimeDelegate.hpp
index 183b26d7..ca1983c8 100755
--- a/item_delegates/SQLiteDateTimeDelegate.hpp
+++ b/item_delegates/SQLiteDateTimeDelegate.hpp
@@ -1,23 +1,23 @@
-#ifndef SQLITE_DATE_TIME_DELEGATE_HPP_
-#define SQLITE_DATE_TIME_DELEGATE_HPP_
-
-#include <QStyledItemDelegate>
-
-//
-// Class SQLiteDateTimeDelegte
-//
-// Item delegate for editing a date and time stored as milliseconds
-// since the Unix epoch and displayed or edited as a QDateTime
-// showing UTC
-//
-class SQLiteDateTimeDelegate final
- : public QStyledItemDelegate
-{
-public:
- explicit SQLiteDateTimeDelegate (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;
-};
-
-#endif
+#ifndef SQLITE_DATE_TIME_DELEGATE_HPP_
+#define SQLITE_DATE_TIME_DELEGATE_HPP_
+
+#include <QStyledItemDelegate>
+
+//
+// Class SQLiteDateTimeDelegte
+//
+// Item delegate for editing a date and time stored as milliseconds
+// since the Unix epoch and displayed or edited as a QDateTime
+// showing UTC
+//
+class SQLiteDateTimeDelegate final
+ : public QStyledItemDelegate
+{
+public:
+ explicit SQLiteDateTimeDelegate (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;
+};
+
+#endif
diff --git a/item_delegates/item_delegates.pri b/item_delegates/item_delegates.pri
index 819cb2e0..cca0c45f 100755
--- a/item_delegates/item_delegates.pri
+++ b/item_delegates/item_delegates.pri
@@ -1,13 +1,13 @@
-SOURCES += \
- item_delegates/ForeignKeyDelegate.cpp \
- item_delegates/FrequencyDelegate.cpp \
- item_delegates/FrequencyDeltaDelegate.cpp \
- item_delegates/CallsignDelegate.cpp \
- item_delegates/MaidenheadLocatorItemDelegate.cpp
-
-HEADERS += \
- item_delegates/ForeignKeyDelegate.hpp \
- item_delegates/FrequencyDelegate.hpp \
- item_delegates/FrequencyDeltaDelegate.hpp \
- item_delegates/CallsignDelegate.hpp \
- item_delegates/MaidenheadLocatorDelegate.hpp
+SOURCES += \
+ item_delegates/ForeignKeyDelegate.cpp \
+ item_delegates/FrequencyDelegate.cpp \
+ item_delegates/FrequencyDeltaDelegate.cpp \
+ item_delegates/CallsignDelegate.cpp \
+ item_delegates/MaidenheadLocatorItemDelegate.cpp
+
+HEADERS += \
+ item_delegates/ForeignKeyDelegate.hpp \
+ item_delegates/FrequencyDelegate.hpp \
+ item_delegates/FrequencyDeltaDelegate.hpp \
+ item_delegates/CallsignDelegate.hpp \
+ item_delegates/MaidenheadLocatorDelegate.hpp