mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 14:48:46 -05:00
a1a6d1bc06
Working frequencies are mode dependent and a reset to defaults button has been added. Also re-factored much of the model and item delegate code to simplify several of the model implementations. Introduced a single routine called from main to register the custom types with Qt. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5453 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
42 lines
1.7 KiB
C++
42 lines
1.7 KiB
C++
#include "ForeignKeyDelegate.hpp"
|
|
|
|
#include <QComboBox>
|
|
|
|
#include "CandidateKeyFilter.hpp"
|
|
|
|
ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel * 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 * 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 ());
|
|
return editor;
|
|
}
|