mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-02 22:14:56 -04:00
Start implememntation of database based Fox log model and a new Fox log window widget
This change incorporates a reorganization of the GUI code with widgets, validators, models, and item delegates being moved to sub-directories. Relax the requirements of the ForeignKeyDelegate and related CandidateKeyFilter classes to allow them to work with constant model pointers for both referenced and referencing models.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#include "ForeignKeyDelegate.hpp"
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
#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 ());
|
||||
return editor;
|
||||
}
|
||||
Reference in New Issue
Block a user