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