mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 14:13:42 -07:00
fix gui (plot) bugs
G keypress event would cause a crash if no data Q keypress didn't work. Thanks to @iceman1001 for identifying and providing the fixes.
This commit is contained in:
parent
babca445ff
commit
5b953895f4
2 changed files with 5 additions and 1 deletions
|
@ -269,6 +269,7 @@ int Plot::xCoordOf(int i, QRect r )
|
||||||
int Plot::yCoordOf(int v, QRect r, int maxVal)
|
int Plot::yCoordOf(int v, QRect r, int maxVal)
|
||||||
{
|
{
|
||||||
int z = (r.bottom() - r.top())/2;
|
int z = (r.bottom() - r.top())/2;
|
||||||
|
if ( maxVal == 0 ) maxVal++;
|
||||||
return -(z * v) / maxVal + z;
|
return -(z * v) / maxVal + z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,6 +580,8 @@ Plot::Plot(QWidget *parent) : QWidget(parent), GraphStart(0), GraphPixelsPerPoin
|
||||||
CursorBPos = 0;
|
CursorBPos = 0;
|
||||||
|
|
||||||
setWindowTitle(tr("Sliders"));
|
setWindowTitle(tr("Sliders"));
|
||||||
|
|
||||||
|
master = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plot::closeEvent(QCloseEvent *event)
|
void Plot::closeEvent(QCloseEvent *event)
|
||||||
|
@ -688,7 +691,7 @@ void Plot::keyPressEvent(QKeyEvent *event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_Q:
|
case Qt::Key_Q:
|
||||||
this->hide();
|
master->hide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
class Plot: public QWidget
|
class Plot: public QWidget
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
QWidget *master;
|
||||||
int GraphStart;
|
int GraphStart;
|
||||||
double GraphPixelsPerPoint;
|
double GraphPixelsPerPoint;
|
||||||
int CursorAPos;
|
int CursorAPos;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue