From 93f078d33901329189e23cf46810d6ec1cd7409c Mon Sep 17 00:00:00 2001 From: Michael Carpenter Date: Thu, 31 Jul 2014 21:22:05 -0400 Subject: [PATCH] TableView3D: Rapid/holddown keypresses on 3d table now act appropriatly A key-holddown will now send 3 updates per second, and one final updates once the key is released. This gives the UI a fluid feel of scrolling, while not slamming on the COM link. This does mean that the UI is technically out of sync with the ECU for 1/3 of a second, but that is acceptable to retain a good UI experience --- core/src/tableview3d.cpp | 19 +++++++++++++------ core/src/tableview3d.h | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/src/tableview3d.cpp b/core/src/tableview3d.cpp index 6c58dc6..05f13eb 100644 --- a/core/src/tableview3d.cpp +++ b/core/src/tableview3d.cpp @@ -87,7 +87,10 @@ TableView3D::TableView3D(QWidget *parent) } void TableView3D::inputTimerTimeout() { - setRange(m_queuedValList); + if (!m_firstKeypress) + { + setRange(m_queuedValList); + } m_inputTimer->stop(); } @@ -324,12 +327,14 @@ void TableView3D::hotKeyPressed(int key,Qt::KeyboardModifier modifier) //Timer is already active, too soon! //Let the table continue to increment... but don't fire off m_queuedValList = vallist; - m_inputTimer->stop(); - m_inputTimer->start(250); + m_firstKeypress = false; + //m_inputTimer->stop(); + //m_inputTimer->start(250); } else { - m_inputTimer->start(250); + m_firstKeypress = true; + m_inputTimer->start(350); setRange(vallist); } } @@ -412,11 +417,13 @@ void TableView3D::hotKeyPressed(int key,Qt::KeyboardModifier modifier) //Timer is already active, too soon! //Let the table continue to increment... but don't fire off m_queuedValList = vallist; - m_inputTimer->stop(); - m_inputTimer->start(250); + m_firstKeypress = false; + //m_inputTimer->stop(); + //m_inputTimer->start(250); } else { + m_firstKeypress = true; m_inputTimer->start(250); setRange(vallist); } diff --git a/core/src/tableview3d.h b/core/src/tableview3d.h index 853f698..5ccbe65 100644 --- a/core/src/tableview3d.h +++ b/core/src/tableview3d.h @@ -42,6 +42,7 @@ class TableView3D : public DataView bool setData(QString name,DataBlock *data); void passDatalog(QVariantMap data); private: + bool m_firstKeypress; QTimer *m_inputTimer; void reColorTable(int rownum,int colnum); QList > m_highlightItemList;