mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-25 05:38:39 -04:00
Improve table scrolling
This commit is contained in:
parent
cd2873dde8
commit
e7d05f832f
plugins/channelrx
@ -27,6 +27,7 @@
|
||||
#include <QRegExp>
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "aisdemodgui.h"
|
||||
|
||||
@ -157,6 +158,10 @@ void AISDemodGUI::messageReceived(const QByteArray& message, const QDateTime& da
|
||||
// Decode the message
|
||||
ais = AISMessage::decode(message);
|
||||
|
||||
// Is scroll bar at bottom
|
||||
QScrollBar *sb = ui->messages->verticalScrollBar();
|
||||
bool scrollToBottom = sb->value() == sb->maximum();
|
||||
|
||||
// Add to messages table
|
||||
ui->messages->setSortingEnabled(false);
|
||||
int row = ui->messages->rowCount();
|
||||
@ -184,7 +189,9 @@ void AISDemodGUI::messageReceived(const QByteArray& message, const QDateTime& da
|
||||
nmeaItem->setText(ais->toNMEA());
|
||||
hexItem->setText(ais->toHex());
|
||||
ui->messages->setSortingEnabled(true);
|
||||
ui->messages->scrollToItem(dateItem); // Will only scroll if not hidden
|
||||
if (scrollToBottom) {
|
||||
ui->messages->scrollToBottom();
|
||||
}
|
||||
filterRow(row);
|
||||
|
||||
delete ais;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "packetdemodgui.h"
|
||||
#include "util/ax25.h"
|
||||
@ -162,6 +163,10 @@ void PacketDemodGUI::packetReceived(QByteArray packet)
|
||||
|
||||
if (ax25.decode(packet))
|
||||
{
|
||||
// Is scroll bar at bottom
|
||||
QScrollBar *sb = ui->packets->verticalScrollBar();
|
||||
bool scrollToBottom = sb->value() == sb->maximum();
|
||||
|
||||
ui->packets->setSortingEnabled(false);
|
||||
int row = ui->packets->rowCount();
|
||||
ui->packets->setRowCount(row + 1);
|
||||
@ -188,7 +193,9 @@ void PacketDemodGUI::packetReceived(QByteArray packet)
|
||||
dataASCIIItem->setText(ax25.m_dataASCII);
|
||||
dataHexItem->setText(ax25.m_dataHex);
|
||||
ui->packets->setSortingEnabled(true);
|
||||
ui->packets->scrollToItem(fromItem);
|
||||
if (scrollToBottom) {
|
||||
ui->packets->scrollToBottom();
|
||||
}
|
||||
filterRow(row);
|
||||
}
|
||||
else
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "pagerdemodgui.h"
|
||||
|
||||
@ -151,6 +152,10 @@ void PagerDemodGUI::messageReceived(const QDateTime dateTime, int address, int f
|
||||
const QString &numericMessage, const QString &alphaMessage,
|
||||
int evenParityErrors, int bchParityErrors)
|
||||
{
|
||||
// Is scroll bar at bottom
|
||||
QScrollBar *sb = ui->messages->verticalScrollBar();
|
||||
bool scrollToBottom = sb->value() == sb->maximum();
|
||||
|
||||
// Add to messages table
|
||||
ui->messages->setSortingEnabled(false);
|
||||
int row = ui->messages->rowCount();
|
||||
@ -244,7 +249,9 @@ void PagerDemodGUI::messageReceived(const QDateTime dateTime, int address, int f
|
||||
evenPEItem->setText(QString("%1").arg(evenParityErrors));
|
||||
bchPEItem->setText(QString("%1").arg(bchParityErrors));
|
||||
ui->messages->setSortingEnabled(true);
|
||||
ui->messages->scrollToItem(dateItem); // Will only scroll if not hidden
|
||||
if (scrollToBottom) {
|
||||
ui->messages->scrollToBottom();
|
||||
}
|
||||
filterRow(row);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user