mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
Fix issues with auto scrolling log winddows to the last added row
This commit is contained in:
parent
49b1a5ac62
commit
041df48e96
@ -85,9 +85,12 @@ AbstractLogWindow::AbstractLogWindow (QString const& settings_key, QSettings * s
|
|||||||
, m_ {this, settings_key, settings, configuration}
|
, m_ {this, settings_key, settings, configuration}
|
||||||
{
|
{
|
||||||
// ensure view scrolls to latest new row
|
// ensure view scrolls to latest new row
|
||||||
connect (&m_->model_, &QAbstractItemModel::rowsInserted, [this] (QModelIndex const& /*parent*/, int /*first*/, int /*last*/) {
|
connect (&m_->model_, &QAbstractItemModel::rowsInserted, this, [this] (QModelIndex const& parent, int /*first*/, int last) {
|
||||||
if (m_->log_view_) m_->log_view_->scrollToBottom ();
|
// note col 0 is hidden so use col 1
|
||||||
});
|
// queued connection required otherwise row may not be available
|
||||||
|
// in time
|
||||||
|
if (m_->log_view_) m_->log_view_->scrollTo (m_->log_view_->model ()->index (last, 1, parent));
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractLogWindow::~AbstractLogWindow ()
|
AbstractLogWindow::~AbstractLogWindow ()
|
||||||
@ -106,6 +109,7 @@ void AbstractLogWindow::set_log_view (QTableView * log_view)
|
|||||||
m_->log_view_->setAlternatingRowColors (true);
|
m_->log_view_->setAlternatingRowColors (true);
|
||||||
m_->log_view_->setSelectionBehavior (QAbstractItemView::SelectRows);
|
m_->log_view_->setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||||
m_->log_view_->setSelectionMode (QAbstractItemView::ExtendedSelection);
|
m_->log_view_->setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||||
|
m_->log_view_->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
|
||||||
m_->model_.setSourceModel (m_->log_view_->model ());
|
m_->model_.setSourceModel (m_->log_view_->model ());
|
||||||
m_->log_view_->setModel (&m_->model_);
|
m_->log_view_->setModel (&m_->model_);
|
||||||
m_->log_view_->setColumnHidden (0, true);
|
m_->log_view_->setColumnHidden (0, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user