mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
no qso #. When date sorted, move to top or bottom
This commit is contained in:
parent
c85ed8cc7d
commit
a1106aff46
@ -88,7 +88,6 @@ CabrilloLog::impl::impl (CabrilloLog * self, Configuration const * configuration
|
|||||||
|
|
||||||
setEditStrategy (QSqlTableModel::OnFieldChange);
|
setEditStrategy (QSqlTableModel::OnFieldChange);
|
||||||
setTable ("cabrillo_log_v2");
|
setTable ("cabrillo_log_v2");
|
||||||
setHeaderData (fieldIndex ("id"), Qt::Horizontal, tr ("Qso #"));
|
|
||||||
setHeaderData (fieldIndex ("frequency"), Qt::Horizontal, tr ("Freq(MHz)"));
|
setHeaderData (fieldIndex ("frequency"), Qt::Horizontal, tr ("Freq(MHz)"));
|
||||||
setHeaderData (fieldIndex ("mode"), Qt::Horizontal, tr ("Mode"));
|
setHeaderData (fieldIndex ("mode"), Qt::Horizontal, tr ("Mode"));
|
||||||
setHeaderData (fieldIndex ("when"), Qt::Horizontal, tr ("Date & Time(UTC)"));
|
setHeaderData (fieldIndex ("when"), Qt::Horizontal, tr ("Date & Time(UTC)"));
|
||||||
|
@ -105,12 +105,12 @@ AbstractLogWindow::AbstractLogWindow (QString const& settings_key, QSettings * s
|
|||||||
(void) (first); // UNUSED
|
(void) (first); // UNUSED
|
||||||
(void) (last); // UNUSED
|
(void) (last); // UNUSED
|
||||||
QTimer::singleShot(0, [=] {
|
QTimer::singleShot(0, [=] {
|
||||||
// if we're sorting by the contact #, then show the most-recently logged contact.
|
// if we're sorting by the date, then show the most-recently logged contact.
|
||||||
// Otherwise, leave the scroll alone
|
// Otherwise, leave the scroll alone
|
||||||
auto horizontal_header = m_->log_view_->horizontalHeader ();
|
auto horizontal_header = m_->log_view_->horizontalHeader ();
|
||||||
if (horizontal_header->sortIndicatorSection() == 0) {
|
if (horizontal_header->sortIndicatorSection() == 3) { // sorting on date?
|
||||||
if (horizontal_header->sortIndicatorOrder() == Qt::AscendingOrder) {
|
if (horizontal_header->sortIndicatorOrder() == Qt::AscendingOrder) {
|
||||||
// we're sorting 1->N, so go to bottom
|
// we're sorting oldes->newest, so go to bottom
|
||||||
m_->log_view_->scrollToBottom();
|
m_->log_view_->scrollToBottom();
|
||||||
} else {
|
} else {
|
||||||
m_->log_view_->scrollToTop();
|
m_->log_view_->scrollToTop();
|
||||||
@ -143,13 +143,13 @@ void AbstractLogWindow::set_log_view (QTableView * log_view)
|
|||||||
log_view->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
|
log_view->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
|
||||||
m_->model_.setSourceModel (log_view->model ());
|
m_->model_.setSourceModel (log_view->model ());
|
||||||
log_view->setModel (&m_->model_);
|
log_view->setModel (&m_->model_);
|
||||||
log_view->setColumnHidden (0, false); // show the ID column, which is also QSO #
|
log_view->setColumnHidden (0, true); // hide the ID column
|
||||||
auto horizontal_header = log_view->horizontalHeader ();
|
auto horizontal_header = log_view->horizontalHeader ();
|
||||||
|
|
||||||
horizontal_header->setResizeContentsPrecision (0); // visible region only
|
horizontal_header->setResizeContentsPrecision (0); // visible region only
|
||||||
horizontal_header->setSectionResizeMode (QHeaderView::ResizeToContents);
|
horizontal_header->setSectionResizeMode (QHeaderView::ResizeToContents);
|
||||||
horizontal_header->setSectionsMovable (true);
|
horizontal_header->setSectionsMovable (true);
|
||||||
horizontal_header->setSortIndicator(0,Qt::AscendingOrder); // sort by the contact id. show 1->N
|
horizontal_header->setSortIndicator(3, Qt::AscendingOrder); // sort by the contact datetime oldest->newest
|
||||||
|
|
||||||
auto vertical_header = log_view->horizontalHeader ();
|
auto vertical_header = log_view->horizontalHeader ();
|
||||||
vertical_header->setResizeContentsPrecision (0); // visible region only
|
vertical_header->setResizeContentsPrecision (0); // visible region only
|
||||||
|
@ -70,8 +70,8 @@ CabrilloLogWindow::CabrilloLogWindow (QSettings * settings, Configuration const
|
|||||||
m_->ui_.log_table_view->setItemDelegateForColumn (3, new SQLiteDateTimeDelegate {this});
|
m_->ui_.log_table_view->setItemDelegateForColumn (3, new SQLiteDateTimeDelegate {this});
|
||||||
m_->ui_.log_table_view->setItemDelegateForColumn (4, new CallsignDelegate {this});
|
m_->ui_.log_table_view->setItemDelegateForColumn (4, new CallsignDelegate {this});
|
||||||
auto h_header = m_->ui_.log_table_view->horizontalHeader ();
|
auto h_header = m_->ui_.log_table_view->horizontalHeader ();
|
||||||
m_->ui_.log_table_view->verticalHeader()->setVisible(false); // turn off line numbers for the table, use index
|
m_->ui_.log_table_view->verticalHeader()->setVisible(false); // turn off line numbers for the table view
|
||||||
h_header->moveSection (7, 2); // band to 2nd column
|
h_header->moveSection (7, 1); // band to first column
|
||||||
}
|
}
|
||||||
|
|
||||||
CabrilloLogWindow::~CabrilloLogWindow ()
|
CabrilloLogWindow::~CabrilloLogWindow ()
|
||||||
|
Loading…
Reference in New Issue
Block a user