mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-13 23:51:49 -05:00
b8e4517718
This include inverting the order of table view rows so the newest is at the top, without that the Qt MVC interactions when using a database table based model is too slow and complex to manage. The table views now have sort by column capability in the normal way (click column header to reverse sort order) for timely logging and non-disruption of Tx starts the log view should be sorted in descending time order and scrolled to the last row added. Without that Fox and contest logging will work but serious delays may be invoked that disrupt operation.
32 lines
926 B
C++
32 lines
926 B
C++
#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);
|
|
}
|
|
|